@@ -60,16 +60,18 @@ |
||
| 60 | 60 | foreach( $allRepos as $repo ) |
| 61 | 61 | { |
| 62 | 62 | $interfaceName = pathinfo( $repo, PATHINFO_FILENAME ); |
| 63 | - if ( in_array( $interfaceName, $skipRepositories ) ) continue; |
|
| 64 | - else |
|
| 63 | + if ( in_array( $interfaceName, $skipRepositories ) ) { |
|
| 64 | + continue; |
|
| 65 | + } else |
|
| 65 | 66 | { |
| 66 | 67 | $commonName = str_replace( 'Interface', '', $interfaceName ); |
| 67 | 68 | $interfaceFullClassName = $baseNamespace.$interfaceName; |
| 68 | 69 | |
| 69 | 70 | foreach( $implementationBindings as $engine => $bindRepositories ) |
| 70 | 71 | { |
| 71 | - if ( $bindRepositories === 'default' ) continue; |
|
| 72 | - else if ( in_array( $interfaceName, $bindRepositories ) ) |
|
| 72 | + if ( $bindRepositories === 'default' ) { |
|
| 73 | + continue; |
|
| 74 | + } else if ( in_array( $interfaceName, $bindRepositories ) ) |
|
| 73 | 75 | { |
| 74 | 76 | $implementation = $engine; |
| 75 | 77 | break; |
@@ -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 | } |
@@ -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 = $this->model->where( $field, $value); |
| 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 | $this->model->save(); |
| 210 | 218 | |
@@ -231,11 +239,15 @@ discard block |
||
| 231 | 239 | { |
| 232 | 240 | $this->applyCriteria(); |
| 233 | 241 | |
| 234 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->delete(); |
|
| 235 | - else |
|
| 242 | + if ( !is_null( $value ) ) { |
|
| 243 | + $result = $this->model->where( $field, $value )->delete(); |
|
| 244 | + } else |
|
| 236 | 245 | { |
| 237 | - if ( !empty( $this->criteria ) ) $result = $this->model->delete(); |
|
| 238 | - else $result = FALSE; |
|
| 246 | + if ( !empty( $this->criteria ) ) { |
|
| 247 | + $result = $this->model->delete(); |
|
| 248 | + } else { |
|
| 249 | + $result = FALSE; |
|
| 250 | + } |
|
| 239 | 251 | } |
| 240 | 252 | |
| 241 | 253 | $this->resetScope(); |
@@ -276,11 +288,15 @@ discard block |
||
| 276 | 288 | { |
| 277 | 289 | $this->applyCriteria(); |
| 278 | 290 | |
| 279 | - if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->forceDelete(); |
|
| 280 | - else |
|
| 291 | + if ( !is_null( $value ) ) { |
|
| 292 | + $result = $this->model->where( $field, $value )->forceDelete(); |
|
| 293 | + } else |
|
| 281 | 294 | { |
| 282 | - if ( !empty( $this->criteria ) ) $result = $this->model->forceDelete(); |
|
| 283 | - else $result = FALSE; |
|
| 295 | + if ( !empty( $this->criteria ) ) { |
|
| 296 | + $result = $this->model->forceDelete(); |
|
| 297 | + } else { |
|
| 298 | + $result = FALSE; |
|
| 299 | + } |
|
| 284 | 300 | } |
| 285 | 301 | |
| 286 | 302 | $this->resetScope(); |
@@ -298,7 +314,9 @@ discard block |
||
| 298 | 314 | */ |
| 299 | 315 | protected function eagerLoadRelations() |
| 300 | 316 | { |
| 301 | - if ( is_array( $this->with ) ) $this->model->with( $this->with ); |
|
| 317 | + if ( is_array( $this->with ) ) { |
|
| 318 | + $this->model->with( $this->with ); |
|
| 319 | + } |
|
| 302 | 320 | } |
| 303 | 321 | |
| 304 | 322 | |
@@ -312,7 +330,9 @@ discard block |
||
| 312 | 330 | |
| 313 | 331 | foreach( $data as $key => $value ) |
| 314 | 332 | { |
| 315 | - if ( !in_array( $key, $fillableFields ) ) unset( $data[ $key ] ); |
|
| 333 | + if ( !in_array( $key, $fillableFields ) ) { |
|
| 334 | + unset( $data[ $key ] ); |
|
| 335 | + } |
|
| 316 | 336 | } |
| 317 | 337 | |
| 318 | 338 | return $data; |
@@ -327,7 +347,9 @@ discard block |
||
| 327 | 347 | { |
| 328 | 348 | foreach( $this->criteria as $criteria ) |
| 329 | 349 | { |
| 330 | - if( $criteria instanceof CriteriaInterface ) $this->model = $criteria->apply( $this->model, $this ); |
|
| 350 | + if( $criteria instanceof CriteriaInterface ) { |
|
| 351 | + $this->model = $criteria->apply( $this->model, $this ); |
|
| 352 | + } |
|
| 331 | 353 | } |
| 332 | 354 | } |
| 333 | 355 | |
@@ -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 | } |