@@ -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; |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | $this->eagerLoadRelations(); |
| 46 | 46 | $this->applyCriteria(); |
| 47 | 47 | |
| 48 | - if ( !is_null( $value ) ) $this->model = $this->model->where( $field, $value ); |
|
| 48 | + if ( !is_null( $value ) ) { |
|
| 49 | + $this->model = $this->model->where( $field, $value ); |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | $result = $this->model->first( $columns ); |
| 51 | 53 | |
@@ -65,7 +67,9 @@ discard block |
||
| 65 | 67 | $this->eagerLoadRelations(); |
| 66 | 68 | $this->applyCriteria(); |
| 67 | 69 | |
| 68 | - if ( !is_null( $value ) && !is_null( $field ) ) $this->model = $this->model->where( $field, $value ); |
|
| 70 | + if ( !is_null( $value ) && !is_null( $field ) ) { |
|
| 71 | + $this->model = $this->model->where( $field, $value ); |
|
| 72 | + } |
|
| 69 | 73 | |
| 70 | 74 | $result = $this->model->get( $columns ); |
| 71 | 75 | |
@@ -111,7 +115,9 @@ discard block |
||
| 111 | 115 | */ |
| 112 | 116 | public function with( $relations ) |
| 113 | 117 | { |
| 114 | - if ( is_string( $relations ) ) $relations = func_get_args(); |
|
| 118 | + if ( is_string( $relations ) ) { |
|
| 119 | + $relations = func_get_args(); |
|
| 120 | + } |
|
| 115 | 121 | |
| 116 | 122 | $this->with = $relations; |
| 117 | 123 | |
@@ -204,7 +210,9 @@ discard block |
||
| 204 | 210 | // Single update. |
| 205 | 211 | $this->model->where( $field, $value)->update( $cleanFields ); |
| 206 | 212 | |
| 207 | - foreach( $cleanFields as $F => $V ) $this->model->{$F} = $V; |
|
| 213 | + foreach( $cleanFields as $F => $V ) { |
|
| 214 | + $this->model->{$F} = $V; |
|
| 215 | + } |
|
| 208 | 216 | |
| 209 | 217 | $returnedVal = $this->model; |
| 210 | 218 | } else |
@@ -229,11 +237,15 @@ discard block |
||
| 229 | 237 | { |
| 230 | 238 | $this->applyCriteria(); |
| 231 | 239 | |
| 232 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->delete(); |
|
| 233 | - else |
|
| 240 | + if ( !is_null( $value ) ) { |
|
| 241 | + $result = $this->model->where( $field, $value )->delete(); |
|
| 242 | + } else |
|
| 234 | 243 | { |
| 235 | - if ( !empty( $this->criteria ) ) $result = $this->model->delete(); |
|
| 236 | - else $result = FALSE; |
|
| 244 | + if ( !empty( $this->criteria ) ) { |
|
| 245 | + $result = $this->model->delete(); |
|
| 246 | + } else { |
|
| 247 | + $result = FALSE; |
|
| 248 | + } |
|
| 237 | 249 | } |
| 238 | 250 | |
| 239 | 251 | $this->resetScope(); |
@@ -274,11 +286,15 @@ discard block |
||
| 274 | 286 | { |
| 275 | 287 | $this->applyCriteria(); |
| 276 | 288 | |
| 277 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->forceDelete(); |
|
| 278 | - else |
|
| 289 | + if ( !is_null( $value ) ) { |
|
| 290 | + $result = $this->model->where( $field, $value )->forceDelete(); |
|
| 291 | + } else |
|
| 279 | 292 | { |
| 280 | - if ( !empty( $this->criteria ) ) $result = $this->model->forceDelete(); |
|
| 281 | - else $result = FALSE; |
|
| 293 | + if ( !empty( $this->criteria ) ) { |
|
| 294 | + $result = $this->model->forceDelete(); |
|
| 295 | + } else { |
|
| 296 | + $result = FALSE; |
|
| 297 | + } |
|
| 282 | 298 | } |
| 283 | 299 | |
| 284 | 300 | $this->resetScope(); |
@@ -296,7 +312,9 @@ discard block |
||
| 296 | 312 | */ |
| 297 | 313 | protected function eagerLoadRelations() |
| 298 | 314 | { |
| 299 | - if ( is_array( $this->with ) ) $this->model = $this->model->with( $this->with ); |
|
| 315 | + if ( is_array( $this->with ) ) { |
|
| 316 | + $this->model = $this->model->with( $this->with ); |
|
| 317 | + } |
|
| 300 | 318 | } |
| 301 | 319 | |
| 302 | 320 | |
@@ -322,7 +340,9 @@ discard block |
||
| 322 | 340 | { |
| 323 | 341 | foreach( $this->criteria as $criteria ) |
| 324 | 342 | { |
| 325 | - if( $criteria instanceof CriteriaInterface ) $this->model = $criteria->apply( $this->model, $this ); |
|
| 343 | + if( $criteria instanceof CriteriaInterface ) { |
|
| 344 | + $this->model = $criteria->apply( $this->model, $this ); |
|
| 345 | + } |
|
| 326 | 346 | } |
| 327 | 347 | } |
| 328 | 348 | |