@@ -20,6 +20,9 @@ |
||
20 | 20 | $definitionCallback($factory); |
21 | 21 | } |
22 | 22 | |
23 | + /** |
|
24 | + * @param Factory $factory |
|
25 | + */ |
|
23 | 26 | protected function addFactory($name, $factory) |
24 | 27 | { |
25 | 28 | $this->factories[$name] = $factory; |
@@ -52,14 +52,14 @@ |
||
52 | 52 | |
53 | 53 | protected function getProxyFactory($name) |
54 | 54 | { |
55 | - return new FactoryProxy(function () use ($name) { |
|
55 | + return new FactoryProxy(function() use ($name) { |
|
56 | 56 | return $this->fetchFactory($name); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | |
60 | 60 | protected function fetchFactory($name) |
61 | 61 | { |
62 | - if (! isset($this->factories[$name])) { |
|
62 | + if (!isset($this->factories[$name])) { |
|
63 | 63 | throw new FactoryNotRegisteredException("'{$name}' is not a registered factory."); |
64 | 64 | } |
65 | 65 | return $this->factories[$name]; |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @return string |
11 | 11 | */ |
12 | - protected static function getFacadeAccessor(){ |
|
12 | + protected static function getFacadeAccessor() { |
|
13 | 13 | return 'adamwathan.faktory'; |
14 | 14 | } |
15 | 15 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function getForeignKey() |
25 | 25 | { |
26 | - if (! is_null($this->foreign_key)) { |
|
26 | + if (!is_null($this->foreign_key)) { |
|
27 | 27 | return $this->foreign_key; |
28 | 28 | } |
29 | 29 | return $this->guessForeignKey(); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected function buildRelationships() |
18 | 18 | { |
19 | 19 | foreach ($this->attributes as $attribute => $value) { |
20 | - if (! $value instanceof Relationship) { |
|
20 | + if (!$value instanceof Relationship) { |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | $relationship = $this->buildRelationship($value); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | { |
39 | 39 | $result = []; |
40 | 40 | foreach ($this->attributes as $attribute => $value) { |
41 | - if (! $value instanceof Relationship) { |
|
41 | + if (!$value instanceof Relationship) { |
|
42 | 42 | $result[$attribute] = $value; |
43 | 43 | } |
44 | 44 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function getInstance() |
14 | 14 | { |
15 | - if (! isset($this->instance)) { |
|
15 | + if (!isset($this->instance)) { |
|
16 | 16 | $this->instance = $this->factory_loader->__invoke(); |
17 | 17 | } |
18 | 18 | return $this->instance; |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | public function buildMany($count, $override_attributes) |
96 | 96 | { |
97 | 97 | $override_attributes = $this->expandAttributesForList($override_attributes, $count); |
98 | - return array_map(function ($i) use ($override_attributes) { |
|
98 | + return array_map(function($i) use ($override_attributes) { |
|
99 | 99 | return $this->build($override_attributes[$i]); |
100 | 100 | }, range(0, $count - 1)); |
101 | 101 | } |
102 | 102 | |
103 | 103 | protected function expandAttributesForList($attributes, $count) |
104 | 104 | { |
105 | - return array_map(function ($i) use ($attributes) { |
|
105 | + return array_map(function($i) use ($attributes) { |
|
106 | 106 | return $this->extractAttributesForIndex($i, $attributes); |
107 | 107 | }, range(0, $count - 1)); |
108 | 108 | } |
109 | 109 | |
110 | 110 | protected function extractAttributesForIndex($i, $attributes) |
111 | 111 | { |
112 | - return array_map(function ($value) use ($i) { |
|
112 | + return array_map(function($value) use ($i) { |
|
113 | 113 | return is_array($value) ? $value[$i] : $value; |
114 | 114 | }, $attributes); |
115 | 115 | } |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | public function createMany($count, $override_attributes) |
118 | 118 | { |
119 | 119 | $override_attributes = $this->expandAttributesForList($override_attributes, $count); |
120 | - return array_map(function ($i) use ($override_attributes) { |
|
120 | + return array_map(function($i) use ($override_attributes) { |
|
121 | 121 | return $this->create($override_attributes[$i]); |
122 | 122 | }, range(0, $count - 1)); |
123 | 123 | } |
124 | 124 | |
125 | 125 | public function define($name, $definitionCallback) |
126 | 126 | { |
127 | - $callback = function ($f) use ($definitionCallback) { |
|
127 | + $callback = function($f) use ($definitionCallback) { |
|
128 | 128 | $f->setAttributes($this->attributes); |
129 | 129 | $definitionCallback($f); |
130 | 130 | }; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function register() |
20 | 20 | { |
21 | - $this->app['adamwathan.faktory'] = $this->app->share(function () { |
|
21 | + $this->app['adamwathan.faktory'] = $this->app->share(function() { |
|
22 | 22 | return new Faktory; |
23 | 23 | }); |
24 | 24 | } |