@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Flugg\Responder\Responder; |
| 4 | 4 | |
| 5 | -if (! function_exists('responder')) { |
|
| 5 | +if ( ! function_exists( 'responder' ) ) { |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * A helper method to quickly resolve the responder out of the service container. |
@@ -11,6 +11,6 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function responder() |
| 13 | 13 | { |
| 14 | - return app(Responder::class); |
|
| 14 | + return app( Responder::class ); |
|
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param Validator $validator |
| 41 | 41 | */ |
| 42 | - public function __construct(Validator $validator) |
|
| 42 | + public function __construct( Validator $validator ) |
|
| 43 | 43 | { |
| 44 | 44 | $this->validator = $validator; |
| 45 | 45 | |
@@ -53,6 +53,6 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getData() |
| 55 | 55 | { |
| 56 | - return ['fields' => $this->validator->getMessageBag()->toArray()]; |
|
| 56 | + return [ 'fields' => $this->validator->getMessageBag()->toArray() ]; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param string $key |
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | - public function relationLoaded($key); |
|
| 41 | + public function relationLoaded( $key ); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Convert the model instance to an array. |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * @param int $status |
| 23 | 23 | * @return $this |
| 24 | 24 | */ |
| 25 | - protected function seeSuccess($data = null, $status = 200) |
|
| 25 | + protected function seeSuccess( $data = null, $status = 200 ) |
|
| 26 | 26 | { |
| 27 | - $response = $this->seeSuccessResponse($data, $status); |
|
| 28 | - $this->seeSuccessData($response->getData(true)['data']); |
|
| 27 | + $response = $this->seeSuccessResponse( $data, $status ); |
|
| 28 | + $this->seeSuccessData( $response->getData( true )[ 'data' ] ); |
|
| 29 | 29 | |
| 30 | 30 | return $this; |
| 31 | 31 | } |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | * @param int $status |
| 38 | 38 | * @return $this |
| 39 | 39 | */ |
| 40 | - protected function seeSuccessEquals($data = null, $status = 200) |
|
| 40 | + protected function seeSuccessEquals( $data = null, $status = 200 ) |
|
| 41 | 41 | { |
| 42 | - $response = $this->seeSuccessResponse($data, $status); |
|
| 43 | - $this->seeJsonEquals($response->getData(true)); |
|
| 42 | + $response = $this->seeSuccessResponse( $data, $status ); |
|
| 43 | + $this->seeJsonEquals( $response->getData( true ) ); |
|
| 44 | 44 | |
| 45 | 45 | return $this; |
| 46 | 46 | } |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | * @param mixed $data |
| 52 | 52 | * @return $this |
| 53 | 53 | */ |
| 54 | - protected function seeSuccessStructure($data = null) |
|
| 54 | + protected function seeSuccessStructure( $data = null ) |
|
| 55 | 55 | { |
| 56 | - $this->seeJsonStructure([ |
|
| 56 | + $this->seeJsonStructure( [ |
|
| 57 | 57 | 'data' => $data |
| 58 | - ]); |
|
| 58 | + ] ); |
|
| 59 | 59 | |
| 60 | 60 | return $this; |
| 61 | 61 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | * @param int $status |
| 68 | 68 | * @return JsonResponse |
| 69 | 69 | */ |
| 70 | - protected function seeSuccessResponse($data = null, $status = 200):JsonResponse |
|
| 70 | + protected function seeSuccessResponse( $data = null, $status = 200 ):JsonResponse |
|
| 71 | 71 | { |
| 72 | - $response = app(Responder::class)->success($data, $status); |
|
| 72 | + $response = app( Responder::class )->success( $data, $status ); |
|
| 73 | 73 | |
| 74 | - $this->seeStatusCode($response->getStatusCode())->seeJson([ |
|
| 74 | + $this->seeStatusCode( $response->getStatusCode() )->seeJson( [ |
|
| 75 | 75 | 'success' => true, |
| 76 | 76 | 'status' => $response->getStatusCode() |
| 77 | - ])->seeJsonStructure(['data']); |
|
| 77 | + ] )->seeJsonStructure( [ 'data' ] ); |
|
| 78 | 78 | |
| 79 | 79 | return $response; |
| 80 | 80 | } |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | * @param mixed $data |
| 86 | 86 | * @return $this |
| 87 | 87 | */ |
| 88 | - protected function seeSuccessData($data = null) |
|
| 88 | + protected function seeSuccessData( $data = null ) |
|
| 89 | 89 | { |
| 90 | - collect($data)->each(function ($value, $key) { |
|
| 91 | - if (is_array($value)) { |
|
| 92 | - $this->seeSuccessData($value); |
|
| 90 | + collect( $data )->each( function ( $value, $key ) { |
|
| 91 | + if ( is_array( $value ) ) { |
|
| 92 | + $this->seeSuccessData( $value ); |
|
| 93 | 93 | } else { |
| 94 | - $this->seeJson([$key => $value]); |
|
| 94 | + $this->seeJson( [ $key => $value ] ); |
|
| 95 | 95 | } |
| 96 | 96 | }); |
| 97 | 97 | |
@@ -104,20 +104,20 @@ discard block |
||
| 104 | 104 | * @param string|array $attributes |
| 105 | 105 | * @return array |
| 106 | 106 | */ |
| 107 | - protected function getSuccessData($attributes = null) |
|
| 107 | + protected function getSuccessData( $attributes = null ) |
|
| 108 | 108 | { |
| 109 | - $rawData = $this->decodeResponseJson()['data']; |
|
| 109 | + $rawData = $this->decodeResponseJson()[ 'data' ]; |
|
| 110 | 110 | |
| 111 | - if (is_null($attributes)) { |
|
| 111 | + if ( is_null( $attributes ) ) { |
|
| 112 | 112 | return $rawData; |
| 113 | - } elseif (is_string($attributes)) { |
|
| 114 | - return array_get($rawData, $attributes); |
|
| 113 | + } elseif ( is_string( $attributes ) ) { |
|
| 114 | + return array_get( $rawData, $attributes ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $data = []; |
|
| 117 | + $data = [ ]; |
|
| 118 | 118 | |
| 119 | - foreach ($attributes as $attribute) { |
|
| 120 | - $data[] = array_get($rawData, $attribute); |
|
| 119 | + foreach ( $attributes as $attribute ) { |
|
| 120 | + $data[ ] = array_get( $rawData, $attribute ); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | return $data; |
@@ -130,25 +130,25 @@ discard block |
||
| 130 | 130 | * @param int|null $status |
| 131 | 131 | * @return $this |
| 132 | 132 | */ |
| 133 | - protected function seeError(string $error, int $status = null) |
|
| 133 | + protected function seeError( string $error, int $status = null ) |
|
| 134 | 134 | { |
| 135 | - if (! is_null($status)) { |
|
| 136 | - $this->seeStatusCode($status); |
|
| 135 | + if ( ! is_null( $status ) ) { |
|
| 136 | + $this->seeStatusCode( $status ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ($this->app->config->get('responder.status_code')) { |
|
| 140 | - $this->seeJson([ |
|
| 139 | + if ( $this->app->config->get( 'responder.status_code' ) ) { |
|
| 140 | + $this->seeJson( [ |
|
| 141 | 141 | 'status' => $status |
| 142 | - ]); |
|
| 142 | + ] ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return $this->seeJson([ |
|
| 145 | + return $this->seeJson( [ |
|
| 146 | 146 | 'success' => false |
| 147 | - ])->seeJsonSubset([ |
|
| 147 | + ] )->seeJsonSubset( [ |
|
| 148 | 148 | 'error' => [ |
| 149 | 149 | 'code' => $error |
| 150 | 150 | ] |
| 151 | - ]); |
|
| 151 | + ] ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param int $status |
| 158 | 158 | * @return $this |
| 159 | 159 | */ |
| 160 | - abstract protected function seeStatusCode($status); |
|
| 160 | + abstract protected function seeStatusCode( $status ); |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Assert that the response contains JSON. |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param bool $negate |
| 167 | 167 | * @return $this |
| 168 | 168 | */ |
| 169 | - abstract public function seeJson(array $data = null, $negate = false); |
|
| 169 | + abstract public function seeJson( array $data = null, $negate = false ); |
|
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Assert that the JSON response has a given structure. |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param array|null $responseData |
| 176 | 176 | * @return $this |
| 177 | 177 | */ |
| 178 | - abstract public function seeJsonStructure(array $structure = null, $responseData = null); |
|
| 178 | + abstract public function seeJsonStructure( array $structure = null, $responseData = null ); |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Assert that the response is a superset of the given JSON. |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @param array $data |
| 184 | 184 | * @return $this |
| 185 | 185 | */ |
| 186 | - abstract protected function seeJsonSubset(array $data); |
|
| 186 | + abstract protected function seeJsonSubset( array $data ); |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Assert that the response contains an exact JSON array. |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param array $data |
| 192 | 192 | * @return $this |
| 193 | 193 | */ |
| 194 | - abstract public function seeJsonEquals(array $data); |
|
| 194 | + abstract public function seeJsonEquals( array $data ); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Validate and return the decoded response JSON. |
@@ -25,9 +25,9 @@ |
||
| 25 | 25 | * @return void |
| 26 | 26 | * @throws ValidationFailedException |
| 27 | 27 | */ |
| 28 | - protected function failedValidation(Validator $validator) |
|
| 28 | + protected function failedValidation( Validator $validator ) |
|
| 29 | 29 | { |
| 30 | - throw new ValidationFailedException($validator); |
|
| 30 | + throw new ValidationFailedException( $validator ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | * @param string $key |
| 20 | 20 | * @return bool |
| 21 | 21 | */ |
| 22 | - public function __isset($key) |
|
| 22 | + public function __isset( $key ) |
|
| 23 | 23 | { |
| 24 | - return parent::__isset(snake_case($key)); |
|
| 24 | + return parent::__isset( snake_case( $key ) ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @param string $key |
| 31 | 31 | * @return mixed |
| 32 | 32 | */ |
| 33 | - public function __get($key) |
|
| 33 | + public function __get( $key ) |
|
| 34 | 34 | { |
| 35 | - return parent::__get(snake_case($key)); |
|
| 35 | + return parent::__get( snake_case( $key ) ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | protected function getValidatorInstance() |
| 44 | 44 | { |
| 45 | - $this->getInputSource()->replace($this->getConvertedParameters()); |
|
| 45 | + $this->getInputSource()->replace( $this->getConvertedParameters() ); |
|
| 46 | 46 | |
| 47 | 47 | return parent::getValidatorInstance(); |
| 48 | 48 | } |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | protected function getConvertedParameters():array |
| 63 | 63 | { |
| 64 | 64 | $parameters = $this->all(); |
| 65 | - $parameters = $this->castBooleans($parameters); |
|
| 66 | - $parameters = $this->convertToSnakeCase($parameters); |
|
| 65 | + $parameters = $this->castBooleans( $parameters ); |
|
| 66 | + $parameters = $this->convertToSnakeCase( $parameters ); |
|
| 67 | 67 | |
| 68 | - if (method_exists($this, 'convertParameters')) { |
|
| 69 | - $parameters = $this->convertParameters($parameters); |
|
| 68 | + if ( method_exists( $this, 'convertParameters' ) ) { |
|
| 69 | + $parameters = $this->convertParameters( $parameters ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | return $parameters; |
@@ -85,16 +85,16 @@ discard block |
||
| 85 | 85 | * @param mixed $input |
| 86 | 86 | * @return array |
| 87 | 87 | */ |
| 88 | - protected function castBooleans($input):array |
|
| 88 | + protected function castBooleans( $input ):array |
|
| 89 | 89 | { |
| 90 | - if ($this->castToBooleanIsDisabled()) { |
|
| 90 | + if ( $this->castToBooleanIsDisabled() ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $casted = []; |
|
| 94 | + $casted = [ ]; |
|
| 95 | 95 | |
| 96 | - foreach ($input as $key => $value) { |
|
| 97 | - $casted[$key] = $this->castValueToBoolean($value); |
|
| 96 | + foreach ( $input as $key => $value ) { |
|
| 97 | + $casted[ $key ] = $this->castValueToBoolean( $value ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | return $casted; |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | * @param mixed $value |
| 117 | 117 | * @return mixed |
| 118 | 118 | */ |
| 119 | - protected function castValueToBoolean($value) |
|
| 119 | + protected function castValueToBoolean( $value ) |
|
| 120 | 120 | { |
| 121 | - if (in_array($value, ['true', 'false'])) { |
|
| 122 | - return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 121 | + if ( in_array( $value, [ 'true', 'false' ] ) ) { |
|
| 122 | + return filter_var( $value, FILTER_VALIDATE_BOOLEAN ); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $value; |
@@ -131,19 +131,19 @@ discard block |
||
| 131 | 131 | * @param mixed $input |
| 132 | 132 | * @return mixed |
| 133 | 133 | */ |
| 134 | - protected function convertToSnakeCase($input) |
|
| 134 | + protected function convertToSnakeCase( $input ) |
|
| 135 | 135 | { |
| 136 | - if ($this->convertToSnakeCaseIsDisabled()) { |
|
| 136 | + if ( $this->convertToSnakeCaseIsDisabled() ) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if (is_null($input)) { |
|
| 140 | + if ( is_null( $input ) ) { |
|
| 141 | 141 | return null; |
| 142 | - } elseif (is_array($input)) { |
|
| 143 | - return $this->convertArrayToSnakeCase($input); |
|
| 142 | + } elseif ( is_array( $input ) ) { |
|
| 143 | + return $this->convertArrayToSnakeCase( $input ); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - return snake_case($input); |
|
| 146 | + return snake_case( $input ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | * @param array $input |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
| 165 | - protected function convertArrayToSnakeCase(array $input):array |
|
| 165 | + protected function convertArrayToSnakeCase( array $input ):array |
|
| 166 | 166 | { |
| 167 | - $converted = []; |
|
| 167 | + $converted = [ ]; |
|
| 168 | 168 | |
| 169 | - foreach ($input as $key => $value) { |
|
| 170 | - $converted[snake_case($key)] = $value; |
|
| 169 | + foreach ( $input as $key => $value ) { |
|
| 170 | + $converted[ snake_case( $key ) ] = $value; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $converted; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param Filesystem $files |
| 45 | 45 | */ |
| 46 | - public function __construct(Filesystem $files) |
|
| 46 | + public function __construct( Filesystem $files ) |
|
| 47 | 47 | { |
| 48 | 48 | parent::__construct(); |
| 49 | 49 | |
@@ -67,21 +67,21 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected function generateTransformer() |
| 69 | 69 | { |
| 70 | - $name = (string) $this->argument('name'); |
|
| 70 | + $name = (string) $this->argument( 'name' ); |
|
| 71 | 71 | $path = $this->laravel->basePath() . '/app/Transformers/' . $name . '.php'; |
| 72 | 72 | |
| 73 | - if ($this->files->exists($path)) { |
|
| 74 | - return $this->error($name . ' already exists!'); |
|
| 73 | + if ( $this->files->exists( $path ) ) { |
|
| 74 | + return $this->error( $name . ' already exists!' ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $this->makeDirectory($path); |
|
| 77 | + $this->makeDirectory( $path ); |
|
| 78 | 78 | |
| 79 | - $stubPath = $this->option('pivot') ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub'; |
|
| 80 | - $stub = $this->files->get(__DIR__ . '/../../' . $stubPath); |
|
| 79 | + $stubPath = $this->option( 'pivot' ) ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub'; |
|
| 80 | + $stub = $this->files->get( __DIR__ . '/../../' . $stubPath ); |
|
| 81 | 81 | |
| 82 | - $this->files->put($path, $this->makeTransformer($name, $stub)); |
|
| 82 | + $this->files->put( $path, $this->makeTransformer( $name, $stub ) ); |
|
| 83 | 83 | |
| 84 | - $this->info('Transformer created successfully.'); |
|
| 84 | + $this->info( 'Transformer created successfully.' ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * @param string $path |
| 91 | 91 | * @return void |
| 92 | 92 | */ |
| 93 | - protected function makeDirectory(string $path) |
|
| 93 | + protected function makeDirectory( string $path ) |
|
| 94 | 94 | { |
| 95 | - if (! $this->files->isDirectory(dirname($path))) { |
|
| 96 | - $this->files->makeDirectory(dirname($path), 0777, true, true); |
|
| 95 | + if ( ! $this->files->isDirectory( dirname( $path ) ) ) { |
|
| 96 | + $this->files->makeDirectory( dirname( $path ), 0777, true, true ); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | * @param string $stub |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - protected function makeTransformer(string $name, string $stub):string |
|
| 107 | + protected function makeTransformer( string $name, string $stub ):string |
|
| 108 | 108 | { |
| 109 | - $stub = $this->replaceNamespace($stub); |
|
| 110 | - $stub = $this->replaceClass($stub, $name); |
|
| 111 | - $stub = $this->replaceModel($stub, $name); |
|
| 109 | + $stub = $this->replaceNamespace( $stub ); |
|
| 110 | + $stub = $this->replaceClass( $stub, $name ); |
|
| 111 | + $stub = $this->replaceModel( $stub, $name ); |
|
| 112 | 112 | |
| 113 | 113 | return $stub; |
| 114 | 114 | } |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | * @param string $stub |
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | - protected function replaceNamespace(string $stub):string |
|
| 122 | + protected function replaceNamespace( string $stub ):string |
|
| 123 | 123 | { |
| 124 | - if (method_exists($this->laravel, 'getNameSpace')) { |
|
| 124 | + if ( method_exists( $this->laravel, 'getNameSpace' ) ) { |
|
| 125 | 125 | $namespace = $this->laravel->getNamespace() . 'Transformers'; |
| 126 | 126 | } else { |
| 127 | 127 | $namespace = 'App\Transformers'; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $stub = str_replace('DummyNamespace', $namespace, $stub); |
|
| 130 | + $stub = str_replace( 'DummyNamespace', $namespace, $stub ); |
|
| 131 | 131 | |
| 132 | 132 | return $stub; |
| 133 | 133 | } |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | * @param string $name |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | - protected function replaceClass(string $stub, string $name):string |
|
| 142 | + protected function replaceClass( string $stub, string $name ):string |
|
| 143 | 143 | { |
| 144 | - $stub = str_replace('DummyClass', $name, $stub); |
|
| 144 | + $stub = str_replace( 'DummyClass', $name, $stub ); |
|
| 145 | 145 | |
| 146 | 146 | return $stub; |
| 147 | 147 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | * @param string $name |
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | - protected function replaceModel(string $stub, string $name):string |
|
| 156 | + protected function replaceModel( string $stub, string $name ):string |
|
| 157 | 157 | { |
| 158 | - $model = $this->getModelNamespace($name); |
|
| 159 | - $class = $this->getClassFromNamespace($model); |
|
| 158 | + $model = $this->getModelNamespace( $name ); |
|
| 159 | + $class = $this->getClassFromNamespace( $model ); |
|
| 160 | 160 | |
| 161 | - $stub = str_replace('DummyModelNamespace', $model, $stub); |
|
| 162 | - $stub = str_replace('DummyModelClass', $class, $stub); |
|
| 163 | - $stub = str_replace('DummyModelVariable', camel_case($class), $stub); |
|
| 161 | + $stub = str_replace( 'DummyModelNamespace', $model, $stub ); |
|
| 162 | + $stub = str_replace( 'DummyModelClass', $class, $stub ); |
|
| 163 | + $stub = str_replace( 'DummyModelVariable', camel_case( $class ), $stub ); |
|
| 164 | 164 | |
| 165 | 165 | return $stub; |
| 166 | 166 | } |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | * @param string $name |
| 172 | 172 | * @return string |
| 173 | 173 | */ |
| 174 | - protected function getModelNamespace(string $name):string |
|
| 174 | + protected function getModelNamespace( string $name ):string |
|
| 175 | 175 | { |
| 176 | - if ($this->option('model')) { |
|
| 177 | - return $this->option('model'); |
|
| 176 | + if ( $this->option( 'model' ) ) { |
|
| 177 | + return $this->option( 'model' ); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - return 'App\\' . str_replace('Transformer', '', $name); |
|
| 180 | + return 'App\\' . str_replace( 'Transformer', '', $name ); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | * @param string $namespace |
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | - protected function getClassFromNamespace(string $namespace):string |
|
| 189 | + protected function getClassFromNamespace( string $namespace ):string |
|
| 190 | 190 | { |
| 191 | - return last(explode('\\', $namespace)); |
|
| 191 | + return last( explode( '\\', $namespace ) ); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | \ No newline at end of file |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function __construct() |
| 21 | 21 | { |
| 22 | - parent::__construct('Given serializer is not an instance of [' . SerializerAbstract::class . '].'); |
|
| 22 | + parent::__construct( 'Given serializer is not an instance of [' . SerializerAbstract::class . '].' ); |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * @param Model $model |
| 21 | 21 | */ |
| 22 | - public function __construct(Model $model) |
|
| 22 | + public function __construct( Model $model ) |
|
| 23 | 23 | { |
| 24 | - parent::__construct('The given transformer does not exist for model [' . get_class($model) . '].'); |
|
| 24 | + parent::__construct( 'The given transformer does not exist for model [' . get_class( $model ) . '].' ); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |