Completed
Branch master (a17b64)
by Rémi
15:50
created
src/MagicSetters.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,28 +7,28 @@
 block discarded – undo
7 7
  */
8 8
 trait MagicSetters
9 9
 {
10
-    /**
11
-     * Dynamically set attributes on the entity.
12
-     *
13
-     * @param  string $key
14
-     * @param  mixed  $value
15
-     * @return void
16
-     */
17
-    public function __set($key, $value)
18
-    {
19
-        $this->attributes[$key] = $value;
20
-    }
10
+	/**
11
+	 * Dynamically set attributes on the entity.
12
+	 *
13
+	 * @param  string $key
14
+	 * @param  mixed  $value
15
+	 * @return void
16
+	 */
17
+	public function __set($key, $value)
18
+	{
19
+		$this->attributes[$key] = $value;
20
+	}
21 21
 
22
-    /**
23
-     * Unset an attribute on the entity.
24
-     *
25
-     * @param  string $key
26
-     * @return void
27
-     */
28
-    public function __unset($key)
29
-    {
30
-        unset($this->attributes[$key]);
31
-    }
22
+	/**
23
+	 * Unset an attribute on the entity.
24
+	 *
25
+	 * @param  string $key
26
+	 * @return void
27
+	 */
28
+	public function __unset($key)
29
+	{
30
+		unset($this->attributes[$key]);
31
+	}
32 32
 
33 33
 
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/MagicGetters.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,48 +12,48 @@
 block discarded – undo
12 12
 	protected $attributes = [];
13 13
 
14 14
 	/**
15
-     * Dynamically retrieve attributes on the entity.
16
-     *
17
-     * @param  string $key
18
-     * @return mixed
19
-     */
20
-    public function __get($key)
21
-    {
22
-    	// When using mixed mapping, we will check
23
-    	// for a class property corresponding to 
24
-    	// the attribute's key first. 
25
-    	// 
26
-    	// Note : this may raise issues as we may grant
27
-    	// access to unwanted properties, like class dependencies. 
28
-    	// 
29
-    	// -> Solution would be to access the entityMap's $attributes, but we
30
-    	// have to do this in a very efficient way.
31
-    	// 
32
-    	// Manager::getEntityMap(get_class($this))->hasProperty()
33
-    	// 
34
-    	// We could do the casting to array / json the same way, and it would 
15
+	 * Dynamically retrieve attributes on the entity.
16
+	 *
17
+	 * @param  string $key
18
+	 * @return mixed
19
+	 */
20
+	public function __get($key)
21
+	{
22
+		// When using mixed mapping, we will check
23
+		// for a class property corresponding to 
24
+		// the attribute's key first. 
25
+		// 
26
+		// Note : this may raise issues as we may grant
27
+		// access to unwanted properties, like class dependencies. 
28
+		// 
29
+		// -> Solution would be to access the entityMap's $attributes, but we
30
+		// have to do this in a very efficient way.
31
+		// 
32
+		// Manager::getEntityMap(get_class($this))->hasProperty()
33
+		// 
34
+		// We could do the casting to array / json the same way, and it would 
35 35
     	
36 36
 
37
-    	if(property_exists($this, $key)) {
38
-    		return $this->$key;
39
-    	}
37
+		if(property_exists($this, $key)) {
38
+			return $this->$key;
39
+		}
40 40
 
41
-    	if(array_key_exists($key, $this->attributes))
42
-    	{
43
-        	return $this->attributes[$key];
44
-        }
41
+		if(array_key_exists($key, $this->attributes))
42
+		{
43
+			return $this->attributes[$key];
44
+		}
45 45
 
46
-        return null;
47
-    }
46
+		return null;
47
+	}
48 48
 
49
-    /**
50
-     * Determine if an attribute exists on the entity.
51
-     *
52
-     * @param  string $key
53
-     * @return bool
54
-     */
55
-    public function __isset($key)
56
-    {
57
-        return array_key_exists($key, $this->attributes) || property_exists($this, $key);
58
-    }
49
+	/**
50
+	 * Determine if an attribute exists on the entity.
51
+	 *
52
+	 * @param  string $key
53
+	 * @return bool
54
+	 */
55
+	public function __isset($key)
56
+	{
57
+		return array_key_exists($key, $this->attributes) || property_exists($this, $key);
58
+	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@
 block discarded – undo
34 34
     	// We could do the casting to array / json the same way, and it would 
35 35
     	
36 36
 
37
-    	if(property_exists($this, $key)) {
37
+    	if (property_exists($this, $key)) {
38 38
     		return $this->$key;
39 39
     	}
40 40
 
41
-    	if(array_key_exists($key, $this->attributes))
41
+    	if (array_key_exists($key, $this->attributes))
42 42
     	{
43 43
         	return $this->attributes[$key];
44 44
         }
Please login to merge, or discard this patch.
src/MagicCasting.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -10,109 +10,109 @@
 block discarded – undo
10 10
 {
11 11
 
12 12
  	/**
13
-     * Determine if the given attribute exists.
14
-     *
15
-     * @param  mixed $offset
16
-     * @return bool
17
-     */
18
-    public function offsetExists($offset)
19
-    {
20
-        return isset($this->$offset);
21
-    }
13
+ 	 * Determine if the given attribute exists.
14
+ 	 *
15
+ 	 * @param  mixed $offset
16
+ 	 * @return bool
17
+ 	 */
18
+	public function offsetExists($offset)
19
+	{
20
+		return isset($this->$offset);
21
+	}
22 22
 
23
-    /**
24
-     * Get the value for a given offset.
25
-     *
26
-     * @param  mixed $offset
27
-     * @return mixed
28
-     */
29
-    public function offsetGet($offset)
30
-    {
31
-        return $this->$offset;
32
-    }
23
+	/**
24
+	 * Get the value for a given offset.
25
+	 *
26
+	 * @param  mixed $offset
27
+	 * @return mixed
28
+	 */
29
+	public function offsetGet($offset)
30
+	{
31
+		return $this->$offset;
32
+	}
33 33
 
34
-    /**
35
-     * Set the value for a given offset.
36
-     *
37
-     * @param  mixed $offset
38
-     * @param  mixed $value
39
-     * @return void
40
-     */
41
-    public function offsetSet($offset, $value)
42
-    {
43
-        $this->$offset = $value;
44
-    }
34
+	/**
35
+	 * Set the value for a given offset.
36
+	 *
37
+	 * @param  mixed $offset
38
+	 * @param  mixed $value
39
+	 * @return void
40
+	 */
41
+	public function offsetSet($offset, $value)
42
+	{
43
+		$this->$offset = $value;
44
+	}
45 45
 
46
-    /**
47
-     * Unset the value for a given offset.
48
-     *
49
-     * @param  mixed $offset
50
-     * @return void
51
-     */
52
-    public function offsetUnset($offset)
53
-    {
54
-        unset($this->$offset);
55
-    }
46
+	/**
47
+	 * Unset the value for a given offset.
48
+	 *
49
+	 * @param  mixed $offset
50
+	 * @return void
51
+	 */
52
+	public function offsetUnset($offset)
53
+	{
54
+		unset($this->$offset);
55
+	}
56 56
 
57
-    /**
58
-     * Convert the object into something JSON serializable.
59
-     *
60
-     * @return array
61
-     */
62
-    public function jsonSerialize()
63
-    {
64
-        return $this->toArray();
65
-    }
57
+	/**
58
+	 * Convert the object into something JSON serializable.
59
+	 *
60
+	 * @return array
61
+	 */
62
+	public function jsonSerialize()
63
+	{
64
+		return $this->toArray();
65
+	}
66 66
 
67
-    /**
68
-     * Convert the entity instance to JSON.
69
-     *
70
-     * @param  int $options
71
-     * @return string
72
-     */
73
-    public function toJson($options = 0)
74
-    {
75
-        return json_encode($this->toArray(), $options);
76
-    }
67
+	/**
68
+	 * Convert the entity instance to JSON.
69
+	 *
70
+	 * @param  int $options
71
+	 * @return string
72
+	 */
73
+	public function toJson($options = 0)
74
+	{
75
+		return json_encode($this->toArray(), $options);
76
+	}
77 77
 
78
-    /**
79
-     * Convert Mappable object to array;
80
-     *
81
-     * @return array
82
-     */
83
-    public function toArray()
84
-    {
85
-        return $this->attributesToArray($this->attributes);
86
-    }
78
+	/**
79
+	 * Convert Mappable object to array;
80
+	 *
81
+	 * @return array
82
+	 */
83
+	public function toArray()
84
+	{
85
+		return $this->attributesToArray($this->attributes);
86
+	}
87 87
 
88
-    /**
89
-     * Transform the Object to array/json,
90
-     *
91
-     * @param  array $sourceAttributes
92
-     * @return array
93
-     */
94
-    protected function attributesToArray(array $sourceAttributes)
95
-    {
96
-        $attributes = [];
88
+	/**
89
+	 * Transform the Object to array/json,
90
+	 *
91
+	 * @param  array $sourceAttributes
92
+	 * @return array
93
+	 */
94
+	protected function attributesToArray(array $sourceAttributes)
95
+	{
96
+		$attributes = [];
97 97
 
98
-        foreach ($sourceAttributes as $key => $attribute) {
99
-            // If the attribute is a proxy, and hasn't be loaded, we discard
100
-            // it from the returned set.
101
-            if ($attribute instanceof ProxyInterface && !$attribute->isProxyInitialized()) {
102
-                continue;
103
-            }
98
+		foreach ($sourceAttributes as $key => $attribute) {
99
+			// If the attribute is a proxy, and hasn't be loaded, we discard
100
+			// it from the returned set.
101
+			if ($attribute instanceof ProxyInterface && !$attribute->isProxyInitialized()) {
102
+				continue;
103
+			}
104 104
 
105
-            if ($attribute instanceof Carbon) {
106
-                $attributes[$key] = $attribute->__toString();
107
-                continue;
108
-            }
105
+			if ($attribute instanceof Carbon) {
106
+				$attributes[$key] = $attribute->__toString();
107
+				continue;
108
+			}
109 109
 
110
-            if ($attribute instanceof Arrayable) {
111
-                $attributes[$key] = $attribute->toArray();
112
-            } else {
113
-                $attributes[$key] = $attribute;
114
-            }
115
-        }
116
-        return $attributes;
117
-    }
110
+			if ($attribute instanceof Arrayable) {
111
+				$attributes[$key] = $attribute->toArray();
112
+			} else {
113
+				$attributes[$key] = $attribute;
114
+			}
115
+		}
116
+		return $attributes;
117
+	}
118 118
 }
Please login to merge, or discard this patch.
src/ValueObject.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 
10 10
 class ValueObject implements Mappable, ArrayAccess, Jsonable, JsonSerializable, Arrayable
11 11
 {
12
-    use MappableTrait;
13
-    use MagicGetters;
14
-    use MagicSetters;
15
-    use MagicCasting;
12
+	use MappableTrait;
13
+	use MagicGetters;
14
+	use MagicSetters;
15
+	use MagicCasting;
16 16
 }
17 17
 
Please login to merge, or discard this patch.
src/System/Proxies/ProxyFactory.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 		$entityMap = Manager::getMapper($entity)->getEntityMap();
21 21
 
22 22
 		$singleRelations = $entityMap->getSingleRelationships();
23
-        $manyRelations = $entityMap->getManyRelationships();
23
+		$manyRelations = $entityMap->getManyRelationships();
24 24
 
25
-        if (in_array($relation, $singleRelations)) {
26
-        	return $this->makeEntityProxy($entity, $relation, $class);
27
-        }
25
+		if (in_array($relation, $singleRelations)) {
26
+			return $this->makeEntityProxy($entity, $relation, $class);
27
+		}
28 28
 
29
-        if (in_array($relation, $manyRelations)) {
30
-        	return new CollectionProxy($entity, $relation);
31
-        }
29
+		if (in_array($relation, $manyRelations)) {
30
+			return new CollectionProxy($entity, $relation);
31
+		}
32 32
 
33
-        throw new MappingException('Could not identity relation '.$relation);
33
+		throw new MappingException('Could not identity relation '.$relation);
34 34
 	}
35 35
 
36 36
 	/**  
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
 			$entityMap = Manager::getMapper($entity)->getEntityMap();
52 52
 
53
-        	$wrappedObject = $entityMap->$relation($entity)->getResults($relation);
53
+			$wrappedObject = $entityMap->$relation($entity)->getResults($relation);
54 54
 
55
-		    $initializer   = null; // disable initialization
56
-		    return true; // confirm that initialization occurred correctly
55
+			$initializer   = null; // disable initialization
56
+			return true; // confirm that initialization occurred correctly
57 57
 		};
58 58
 
59 59
 		return $factory->createProxy($class, $initializer);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@
 block discarded – undo
46 46
 	{
47 47
 		$factory = new LazyLoadingValueHolderFactory();
48 48
 	 
49
-		$initializer = function (& $wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, & $initializer) use ($entity, $relation) {
49
+		$initializer = function(& $wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, & $initializer) use ($entity, $relation) {
50 50
 
51 51
 			$entityMap = Manager::getMapper($entity)->getEntityMap();
52 52
 
53 53
         	$wrappedObject = $entityMap->$relation($entity)->getResults($relation);
54 54
 
55
-		    $initializer   = null; // disable initialization
55
+		    $initializer = null; // disable initialization
56 56
 		    return true; // confirm that initialization occurred correctly
57 57
 		};
58 58
 
Please login to merge, or discard this patch.
src/MappableTrait.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -8,63 +8,63 @@
 block discarded – undo
8 8
  */
9 9
 trait MappableTrait
10 10
 {
11
-    /**
12
-     * The Entity's Attributes
13
-     * @var array
14
-     */
15
-    //protected $attributes = [];
11
+	/**
12
+	 * The Entity's Attributes
13
+	 * @var array
14
+	 */
15
+	//protected $attributes = [];
16 16
 
17
-    /**
18
-     * Method used by the mapper to set the object
19
-     * attribute raw values (hydration)
20
-     *
21
-     * @param array $attributes
22
-     *
23
-     * @return void
24
-     */
25
-    public function setEntityAttributes(array $attributes)
26
-    {
27
-        $this->attributes = $attributes;
28
-    }
17
+	/**
18
+	 * Method used by the mapper to set the object
19
+	 * attribute raw values (hydration)
20
+	 *
21
+	 * @param array $attributes
22
+	 *
23
+	 * @return void
24
+	 */
25
+	public function setEntityAttributes(array $attributes)
26
+	{
27
+		$this->attributes = $attributes;
28
+	}
29 29
 
30
-    /**
31
-     * Method used by the mapper to get the
32
-     * raw object's values.
33
-     *
34
-     * @return array
35
-     */
36
-    public function getEntityAttributes()
37
-    {
38
-        return $this->attributes;
39
-    }
30
+	/**
31
+	 * Method used by the mapper to get the
32
+	 * raw object's values.
33
+	 *
34
+	 * @return array
35
+	 */
36
+	public function getEntityAttributes()
37
+	{
38
+		return $this->attributes;
39
+	}
40 40
 
41
-    /**
42
-     * Method used by the mapper to set raw
43
-     * key-value pair
44
-     *
45
-     * @param string $key
46
-     * @param string $value
47
-     *
48
-     * @return void
49
-     */
50
-    public function setEntityAttribute($key, $value)
51
-    {
52
-        $this->attributes[$key] = $value;
53
-    }
41
+	/**
42
+	 * Method used by the mapper to set raw
43
+	 * key-value pair
44
+	 *
45
+	 * @param string $key
46
+	 * @param string $value
47
+	 *
48
+	 * @return void
49
+	 */
50
+	public function setEntityAttribute($key, $value)
51
+	{
52
+		$this->attributes[$key] = $value;
53
+	}
54 54
 
55
-    /**
56
-     * Method used by the mapper to get single
57
-     * key-value pair
58
-     *
59
-     * @param  string $key
60
-     * @return mixed|null
61
-     */
62
-    public function getEntityAttribute($key)
63
-    {
64
-        if (array_key_exists($key, $this->attributes)) {
65
-            return $this->attributes[$key];
66
-        } else {
67
-            return null;
68
-        }
69
-    }
55
+	/**
56
+	 * Method used by the mapper to get single
57
+	 * key-value pair
58
+	 *
59
+	 * @param  string $key
60
+	 * @return mixed|null
61
+	 */
62
+	public function getEntityAttribute($key)
63
+	{
64
+		if (array_key_exists($key, $this->attributes)) {
65
+			return $this->attributes[$key];
66
+		} else {
67
+			return null;
68
+		}
69
+	}
70 70
 }
Please login to merge, or discard this patch.