Passed
Push — master ( ae2464...577968 )
by Rick
04:20
created
src/ComponentContainer.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -12,49 +12,49 @@
 block discarded – undo
12 12
 
13 13
 class ComponentContainer implements ContainerInterface
14 14
 {
15
-	/**
16
-	 * @var object[]
17
-	 */
18
-	protected $storedComponents = [];
19
-
20
-	/**
21
-	 * @param ComponentInterface $object $object
22
-	 *
23
-	 * @throws ContainerException
24
-	 */
25
-	public function add(ComponentInterface $object)
26
-	{
27
-	    $id = get_class($object);
28
-
29
-	    if ($this->has($id))
30
-	        throw new ContainerException('A class with ID ' . $id . ' already exists in this container.');
31
-
32
-		$this->storedComponents[$id] = $object;
33
-	}
34
-
35
-	/**
36
-	 * @inheritdoc
37
-	 */
38
-	public function get($id)
39
-	{
40
-		if (!is_string($id))
41
-			throw new ContainerException('Given ID must be a string');
42
-
43
-		if (!$this->has($id))
44
-			throw new NotFoundException();
45
-
46
-		return $this->storedComponents[$id];
47
-	}
48
-
49
-	/**
50
-	 * @inheritdoc
15
+    /**
16
+     * @var object[]
17
+     */
18
+    protected $storedComponents = [];
19
+
20
+    /**
21
+     * @param ComponentInterface $object $object
22
+     *
51 23
      * @throws ContainerException
52
-	 */
53
-	public function has($id)
54
-	{
55
-		if (!is_string($id))
56
-			throw new ContainerException('Given ID must be a string');
57
-
58
-		return array_key_exists($id, $this->storedComponents);
59
-	}
24
+     */
25
+    public function add(ComponentInterface $object)
26
+    {
27
+        $id = get_class($object);
28
+
29
+        if ($this->has($id))
30
+            throw new ContainerException('A class with ID ' . $id . ' already exists in this container.');
31
+
32
+        $this->storedComponents[$id] = $object;
33
+    }
34
+
35
+    /**
36
+     * @inheritdoc
37
+     */
38
+    public function get($id)
39
+    {
40
+        if (!is_string($id))
41
+            throw new ContainerException('Given ID must be a string');
42
+
43
+        if (!$this->has($id))
44
+            throw new NotFoundException();
45
+
46
+        return $this->storedComponents[$id];
47
+    }
48
+
49
+    /**
50
+     * @inheritdoc
51
+     * @throws ContainerException
52
+     */
53
+    public function has($id)
54
+    {
55
+        if (!is_string($id))
56
+            throw new ContainerException('Given ID must be a string');
57
+
58
+        return array_key_exists($id, $this->storedComponents);
59
+    }
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 	    $id = get_class($object);
28 28
 
29
-	    if ($this->has($id))
30
-	        throw new ContainerException('A class with ID ' . $id . ' already exists in this container.');
29
+	    if ($this->has($id)) {
30
+	    	        throw new ContainerException('A class with ID ' . $id . ' already exists in this container.');
31
+	    }
31 32
 
32 33
 		$this->storedComponents[$id] = $object;
33 34
 	}
@@ -37,11 +38,13 @@  discard block
 block discarded – undo
37 38
 	 */
38 39
 	public function get($id)
39 40
 	{
40
-		if (!is_string($id))
41
-			throw new ContainerException('Given ID must be a string');
41
+		if (!is_string($id)) {
42
+					throw new ContainerException('Given ID must be a string');
43
+		}
42 44
 
43
-		if (!$this->has($id))
44
-			throw new NotFoundException();
45
+		if (!$this->has($id)) {
46
+					throw new NotFoundException();
47
+		}
45 48
 
46 49
 		return $this->storedComponents[$id];
47 50
 	}
@@ -52,8 +55,9 @@  discard block
 block discarded – undo
52 55
 	 */
53 56
 	public function has($id)
54 57
 	{
55
-		if (!is_string($id))
56
-			throw new ContainerException('Given ID must be a string');
58
+		if (!is_string($id)) {
59
+					throw new ContainerException('Given ID must be a string');
60
+		}
57 61
 
58 62
 		return array_key_exists($id, $this->storedComponents);
59 63
 	}
Please login to merge, or discard this patch.
src/ComponentInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 
14 14
 interface ComponentInterface
15 15
 {
16
-	/**
17
-	 * @param ContainerInterface $container
18
-	 *
19
-	 * @return null|object
20
-	 */
21
-	public static function fromContainer(ContainerInterface $container);
16
+    /**
17
+     * @param ContainerInterface $container
18
+     *
19
+     * @return null|object
20
+     */
21
+    public static function fromContainer(ContainerInterface $container);
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/ContainerTrait.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@
 block discarded – undo
13 13
 
14 14
 trait ContainerTrait
15 15
 {
16
-	/**
17
-	 * @var ContainerInterface
18
-	 */
19
-	protected $container;
16
+    /**
17
+     * @var ContainerInterface
18
+     */
19
+    protected $container;
20 20
 
21
-	/**
22
-	 * @return ContainerInterface
23
-	 */
24
-	public function getContainer(): ContainerInterface
25
-	{
26
-		return $this->container;
27
-	}
21
+    /**
22
+     * @return ContainerInterface
23
+     */
24
+    public function getContainer(): ContainerInterface
25
+    {
26
+        return $this->container;
27
+    }
28 28
 
29
-	/**
30
-	 * @param ContainerInterface $container
31
-	 */
32
-	public function setContainer(ContainerInterface $container)
33
-	{
34
-		$this->container = $container;
35
-	}
29
+    /**
30
+     * @param ContainerInterface $container
31
+     */
32
+    public function setContainer(ContainerInterface $container)
33
+    {
34
+        $this->container = $container;
35
+    }
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
src/ComponentTrait.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 
13 13
 trait ComponentTrait
14 14
 {
15
-	/**
16
-	 * @param ContainerInterface $container
17
-	 *
18
-	 * @return static
19
-	 * @throws NotFoundException
20
-	 */
21
-	public static function fromContainer(ContainerInterface $container)
22
-	{
23
-		$obj = $container->get(__CLASS__);
15
+    /**
16
+     * @param ContainerInterface $container
17
+     *
18
+     * @return static
19
+     * @throws NotFoundException
20
+     */
21
+    public static function fromContainer(ContainerInterface $container)
22
+    {
23
+        $obj = $container->get(__CLASS__);
24 24
 
25
-		if ($obj && $obj instanceof static)
26
-			return $obj;
25
+        if ($obj && $obj instanceof static)
26
+            return $obj;
27 27
 
28
-		throw new NotFoundException();
29
-	}
28
+        throw new NotFoundException();
29
+    }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
 	{
23 23
 		$obj = $container->get(__CLASS__);
24 24
 
25
-		if ($obj && $obj instanceof static)
26
-			return $obj;
25
+		if ($obj && $obj instanceof static) {
26
+					return $obj;
27
+		}
27 28
 
28 29
 		throw new NotFoundException();
29 30
 	}
Please login to merge, or discard this patch.