php-school / learn-you-php

🏆 Learn You PHP! - An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.
http://www.phpschool.io/
MIT License
319 stars 36 forks source link

Basic exceptions exercise for try... catch logic #6

Closed mikeymike closed 8 years ago

mikeymike commented 8 years ago

User is required to create a program that outputs a specific string when a file does not exist.

They are urged to use SplFileObject with try... catch logic for the RuntimeException it throws when the file path can't be opened. They are also banned from using array_filter and file_exists functions to prevent the approach detailed in the ArrayWeGo exercise.

Also as we are trying to be an educational resource I thought it may be best to add a disclaimer to this exercise as using exceptions as a method of control flow seems to be frowned upon. Let me know your thoughts on this.

codecov-io commented 8 years ago

Current coverage is 100.00%

Merging #6 into master will not affect coverage as of 4a5a6de

@@            master      #6   diff @@
======================================
  Files            5       6     +1
  Stmts          133     167    +34
  Branches         0       0       
  Methods         41      51    +10
======================================
+ Hit            133     167    +34
  Partial          0       0       
  Missed           0       0       

Review entire Coverage Diff as of 4a5a6de

Powered by Codecov. Updated on successful CI builds.

mikeymike commented 8 years ago

Thoughts on removing tests from Scrutinzer, they drop the code quality down :(

AydinHassan commented 8 years ago

@mikeymike Lets leave the tests and disable the duplication check. It's mostly bogus IMO. Make those small doc changes and we'll get this merged :+1:

mikeymike commented 8 years ago

@AydinHassan Updated, made some minor changes to the expected output to better fit the new documentation :smile:

AydinHassan commented 8 years ago

:ox: