@@ -51,7 +51,9 @@ discard block |
||
51 | 51 | $this->criteriaFolder = ucfirst( $this->implementation ); |
52 | 52 | |
53 | 53 | $folder = pathinfo( $criteriaNameForFolder , PATHINFO_DIRNAME );; |
54 | - if ( $folder ) $this->criteriaFolder .= '/'.$folder; |
|
54 | + if ( $folder ) { |
|
55 | + $this->criteriaFolder .= '/'.$folder; |
|
56 | + } |
|
55 | 57 | |
56 | 58 | $this->criteriaClassName = pathinfo( $criteriaNameForFolder , PATHINFO_FILENAME ); |
57 | 59 | $this->criteriaClassNamespace = rtrim( config( 'repositories.criterias_namespace' ), '\\' ) . '\\' . str_replace( '/', '\\', $this->criteriaFolder ); |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | { |
65 | 67 | $basePath = config( 'repositories.criterias_path' ); |
66 | 68 | |
67 | - if ( $this->criteriaFolder ) $basePath .= '/'.$this->criteriaFolder; |
|
69 | + if ( $this->criteriaFolder ) { |
|
70 | + $basePath .= '/'.$this->criteriaFolder; |
|
71 | + } |
|
68 | 72 | |
69 | 73 | $this->makeDirectory( $basePath ); |
70 | 74 |
@@ -21,8 +21,11 @@ discard block |
||
21 | 21 | { |
22 | 22 | $amount = $this->getAmount( $amount ); |
23 | 23 | |
24 | - if ( $amount ) $model->increment( $counter, $amount ); |
|
25 | - else $model->increment( $counter ); |
|
24 | + if ( $amount ) { |
|
25 | + $model->increment( $counter, $amount ); |
|
26 | + } else { |
|
27 | + $model->increment( $counter ); |
|
28 | + } |
|
26 | 29 | |
27 | 30 | return $model; |
28 | 31 | } |
@@ -50,7 +53,9 @@ discard block |
||
50 | 53 | $model->save(); |
51 | 54 | } |
52 | 55 | |
53 | - } else $model->decrement( $counter, $amount ); |
|
56 | + } else { |
|
57 | + $model->decrement( $counter, $amount ); |
|
58 | + } |
|
54 | 59 | |
55 | 60 | return $model; |
56 | 61 | } |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | $column = $filter[0]; |
44 | 44 | $operation = $filter[1]; |
45 | 45 | $value = $filter[2]; |
46 | - } else continue; |
|
46 | + } else { |
|
47 | + continue; |
|
48 | + } |
|
47 | 49 | |
48 | 50 | $modelOrBuilder = $this->applyFilter( $modelOrBuilder, $column, $value, $operation ); |
49 | 51 | } |
@@ -60,8 +62,11 @@ discard block |
||
60 | 62 | */ |
61 | 63 | private function applyFilter( $modelOrBuilder, $column, $value, $operation = NULL ) |
62 | 64 | { |
63 | - if ( is_null( $operation ) ) $modelOrBuilder = $modelOrBuilder->where( $column, $value ); |
|
64 | - else $modelOrBuilder = $modelOrBuilder->where( $column, $operation, $value ); |
|
65 | + if ( is_null( $operation ) ) { |
|
66 | + $modelOrBuilder = $modelOrBuilder->where( $column, $value ); |
|
67 | + } else { |
|
68 | + $modelOrBuilder = $modelOrBuilder->where( $column, $operation, $value ); |
|
69 | + } |
|
65 | 70 | |
66 | 71 | return $modelOrBuilder; |
67 | 72 | } |
@@ -63,16 +63,18 @@ |
||
63 | 63 | { |
64 | 64 | $implementation = $defaultImplementation; |
65 | 65 | $interfaceName = pathinfo( $repo, PATHINFO_FILENAME ); |
66 | - if ( in_array( $interfaceName, $skipRepositories ) ) continue; |
|
67 | - else |
|
66 | + if ( in_array( $interfaceName, $skipRepositories ) ) { |
|
67 | + continue; |
|
68 | + } else |
|
68 | 69 | { |
69 | 70 | $commonName = str_replace( 'Interface', '', $interfaceName ); |
70 | 71 | $interfaceFullClassName = $baseNamespace.$interfaceName; |
71 | 72 | |
72 | 73 | foreach( $implementationBindings as $engine => $bindRepositories ) |
73 | 74 | { |
74 | - if ( $bindRepositories === 'default' ) continue; |
|
75 | - else if ( in_array( $interfaceName, $bindRepositories ) ) |
|
75 | + if ( $bindRepositories === 'default' ) { |
|
76 | + continue; |
|
77 | + } else if ( in_array( $interfaceName, $bindRepositories ) ) |
|
76 | 78 | { |
77 | 79 | $implementation = $engine; |
78 | 80 | break; |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | $this->eagerLoadRelations(); |
49 | 49 | $this->applyCriteria(); |
50 | 50 | |
51 | - if ( !is_null( $value ) ) $this->model = $this->model->where( $field, $value ); |
|
51 | + if ( !is_null( $value ) ) { |
|
52 | + $this->model = $this->model->where( $field, $value ); |
|
53 | + } |
|
52 | 54 | |
53 | 55 | $result = $this->model->first( $columns ); |
54 | 56 | |
@@ -68,7 +70,9 @@ discard block |
||
68 | 70 | $this->eagerLoadRelations(); |
69 | 71 | $this->applyCriteria(); |
70 | 72 | |
71 | - if ( !is_null( $value ) && !is_null( $field ) ) $this->model = $this->model->where( $field, $value ); |
|
73 | + if ( !is_null( $value ) && !is_null( $field ) ) { |
|
74 | + $this->model = $this->model->where( $field, $value ); |
|
75 | + } |
|
72 | 76 | |
73 | 77 | $result = $this->model->get( $columns ); |
74 | 78 | |
@@ -115,7 +119,9 @@ discard block |
||
115 | 119 | */ |
116 | 120 | public function with( $relations ) |
117 | 121 | { |
118 | - if ( is_string( $relations ) ) $relations = func_get_args(); |
|
122 | + if ( is_string( $relations ) ) { |
|
123 | + $relations = func_get_args(); |
|
124 | + } |
|
119 | 125 | |
120 | 126 | $this->with = $relations; |
121 | 127 | |
@@ -208,7 +214,9 @@ discard block |
||
208 | 214 | // Single update. |
209 | 215 | $this->model->where( $field, $value)->update( $cleanFields ); |
210 | 216 | |
211 | - foreach( $cleanFields as $F => $V ) $this->model->{$F} = $V; |
|
217 | + foreach( $cleanFields as $F => $V ) { |
|
218 | + $this->model->{$F} = $V; |
|
219 | + } |
|
212 | 220 | |
213 | 221 | $returnedVal = $this->model; |
214 | 222 | } else |
@@ -234,11 +242,15 @@ discard block |
||
234 | 242 | { |
235 | 243 | $this->applyCriteria(); |
236 | 244 | |
237 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->delete(); |
|
238 | - else |
|
245 | + if ( !is_null( $value ) ) { |
|
246 | + $result = $this->model->where( $field, $value )->delete(); |
|
247 | + } else |
|
239 | 248 | { |
240 | - if ( !empty( $this->criteria ) ) $result = $this->model->delete(); |
|
241 | - else $result = FALSE; |
|
249 | + if ( !empty( $this->criteria ) ) { |
|
250 | + $result = $this->model->delete(); |
|
251 | + } else { |
|
252 | + $result = FALSE; |
|
253 | + } |
|
242 | 254 | } |
243 | 255 | |
244 | 256 | $this->resetScope(); |
@@ -279,11 +291,15 @@ discard block |
||
279 | 291 | { |
280 | 292 | $this->applyCriteria(); |
281 | 293 | |
282 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->forceDelete(); |
|
283 | - else |
|
294 | + if ( !is_null( $value ) ) { |
|
295 | + $result = $this->model->where( $field, $value )->forceDelete(); |
|
296 | + } else |
|
284 | 297 | { |
285 | - if ( !empty( $this->criteria ) ) $result = $this->model->forceDelete(); |
|
286 | - else $result = FALSE; |
|
298 | + if ( !empty( $this->criteria ) ) { |
|
299 | + $result = $this->model->forceDelete(); |
|
300 | + } else { |
|
301 | + $result = FALSE; |
|
302 | + } |
|
287 | 303 | } |
288 | 304 | |
289 | 305 | $this->resetScope(); |
@@ -329,7 +345,9 @@ discard block |
||
329 | 345 | { |
330 | 346 | foreach( $this->criteria as $criteria ) |
331 | 347 | { |
332 | - if( $criteria instanceof CriteriaInterface ) $this->model = $criteria->apply( $this->model, $this ); |
|
348 | + if( $criteria instanceof CriteriaInterface ) { |
|
349 | + $this->model = $criteria->apply( $this->model, $this ); |
|
350 | + } |
|
333 | 351 | } |
334 | 352 | } |
335 | 353 |
@@ -29,7 +29,9 @@ |
||
29 | 29 | public function apply( $queryBuilder ) |
30 | 30 | { |
31 | 31 | // Do something with the query builder and return it. |
32 | - if ( $this->with ) $queryBuilder->with( $this->with ); |
|
32 | + if ( $this->with ) { |
|
33 | + $queryBuilder->with( $this->with ); |
|
34 | + } |
|
33 | 35 | |
34 | 36 | return $queryBuilder; |
35 | 37 | } |