Completed
Push — develop ( 3a3f88...633b58 )
by Paul
02:04
created
src/Helpers/Media.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	protected $image;
22 22
 	protected $video;
23 23
 
24
-	public function __construct( Gallery $gallery, Image $image, Video $video )
24
+	public function __construct(Gallery $gallery, Image $image, Video $video)
25 25
 	{
26 26
 		$this->gallery = $gallery;
27 27
 		$this->image   = $image;
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 	 * @return string|void
35 35
 	 * @throws BadMethodCallException
36 36
 	 */
37
-	public function __call( $name, array $args )
37
+	public function __call($name, array $args)
38 38
 	{
39
-		$mediaType = $this->validateMethod( $name );
39
+		$mediaType = $this->validateMethod($name);
40 40
 
41
-		if( !count( $args )) {
42
-			throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name ));
41
+		if (!count($args)) {
42
+			throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name));
43 43
 		}
44
-		if( str_replace( $mediaType, '', strtolower( $name ))) {
45
-			return $this->$mediaType->get( $args[0] )->$mediaType;
44
+		if (str_replace($mediaType, '', strtolower($name))) {
45
+			return $this->$mediaType->get($args[0])->$mediaType;
46 46
 		}
47
-		return !empty( $args[1] )
48
-			? $this->$mediaType->get( $args[0] )->render( $args[1] )
49
-			: $this->$mediaType->get( $args[0] )->render();
47
+		return !empty($args[1])
48
+			? $this->$mediaType->get($args[0])->render($args[1])
49
+			: $this->$mediaType->get($args[0])->render();
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 * @return mixed
57 57
 	 * @throws BadMethodCallException
58 58
 	 */
59
-	public function get( $name, $args = [] )
59
+	public function get($name, $args = [])
60 60
 	{
61
-		$mediaType = $this->validateMethod( $name );
62
-		return $this->$mediaType->get( $args )->$mediaType;
61
+		$mediaType = $this->validateMethod($name);
62
+		return $this->$mediaType->get($args)->$mediaType;
63 63
 	}
64 64
 
65 65
 	/**
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	 * @return string|false
69 69
 	 * @throws BadMethodCallException
70 70
 	 */
71
-	protected function validateMethod( $name )
71
+	protected function validateMethod($name)
72 72
 	{
73
-		foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) {
74
-			if( property_exists( $this, $method ) && is_object( $this->$method )) {
73
+		foreach ([$name, strtolower(substr($name, 3))] as $method) {
74
+			if (property_exists($this, $method) && is_object($this->$method)) {
75 75
 				return $method;
76 76
 			}
77 77
 		}
78
-		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
78
+		throw new BadMethodCallException(sprintf('Not a valid method: %s', $name));
79 79
 	}
80 80
 }
Please login to merge, or discard this patch.