Commit 1 of 3:
86a42145d9
Implement Feature Exception
next
whole branch
Review threads live on the whole diff, not on one commit, so
none are shown here - a thread's line means something in the
branch's final form, and painting it into an intermediate
step would put it on code it is not about.
src/Client.php modified +1 -1 Changes to src/Client.php ⋯ 175 lines Show the 175 lines above this hunk @@ -176,7 +176,7 @@ class Client 176 176 * 177 177 * @ return Meema \ MeemaClient \ Functions \ Video 178 178 * / 179 - public function videos ( ) : Video 179 + public function video ( ) : Video 180 180 { 181 181 return new Video ( $this ) ; 182 182 }
src/Exceptions/InvalidFormatException.php -> src/Exceptions/FeatureNotImplementedException.phpcopied +1 -1 Changes to src/Exceptions/FeatureNotImplementedException.php ⋯ 3 lines Show the 3 lines above this hunk @@ -4,7 +4,7 @@ namespace Meema\MeemaClient\Exceptions; 4 4 5 5 use Exception ; 6 6 7 - class InvalidFormatException extends Exception 7 + class FeatureNotImplementedException extends Exception 8 8 { 9 9 10 10
src/Functions/Image.php modified +2 -1 Changes to src/Functions/Image.php ⋯ 3 lines Show the 3 lines above this hunk @@ -4,10 +4,11 @@ namespace Meema\MeemaClient\Functions; 4 4 5 5 use Meema \ MeemaClient \ Client ; 6 6 use Meema \ MeemaClient \ Traits \ UrlResponse ; 7 + use Meema \ MeemaClient \ Traits \ DetectsFeature ; 7 8 8 9 class Image 9 10 { 10 - use UrlResponse ; 11 + use UrlResponse , DetectsFeature ; 11 12 12 13 13 14
src/Functions/Video.php modified +2 -1 Changes to src/Functions/Video.php ⋯ 2 lines Show the 2 lines above this hunk @@ -3,11 +3,12 @@3 3 namespace Meema \ MeemaClient \ Functions ; 4 4 5 5 use Meema \ MeemaClient \ Client ; 6 + use Meema \ MeemaClient \ Traits \ DetectsFeature ; 6 7 use Meema \ MeemaClient \ Traits \ UrlResponse ; 7 8 8 9 class Video 9 10 { 10 - use UrlResponse ; 11 + use UrlResponse , DetectsFeature ; 11 12 12 13 13 14
src/Traits/DetectsFeature.php added +15 -0 Changes to src/Traits/DetectsFeature.php @@ -0,0 +1,15 @@ 1 + < ? php 2 + 3 + namespace Meema \ MeemaClient \ Traits ; 4 + 5 + use Meema \ MeemaClient \ Exceptions \ FeatureNotImplementedException ; 6 + 7 + trait DetectsFeature 8 + { 9 + public function __call ( $name , $arguments ) 10 + { 11 + if ( ! method_exists ( $this , $name ) ) { 12 + throw new FeatureNotImplementedException ( 'Feature not yet implemented. Please contact us if this is something you would like to see rather sooner than later.' ) ; 13 + } 14 + } 15 + }