@@ -39,7 +39,7 @@ |
||
| 39 | 39 | protected function buildNamespace(array $classes) |
| 40 | 40 | { |
| 41 | 41 | // Transform all class names. |
| 42 | - array_walk($classes, function (&$class, $key) { |
|
| 42 | + array_walk($classes, function(&$class, $key) { |
|
| 43 | 43 | |
| 44 | 44 | // Determine wheter class starts with backslash. |
| 45 | 45 | $appends = starts_with($class, '\\'); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param array $params |
| 76 | 76 | * @return this |
| 77 | 77 | */ |
| 78 | - public function forModel(Model $model, array $params = []) |
|
| 78 | + public function forModel(Model $model, array $params = [ ]) |
|
| 79 | 79 | { |
| 80 | 80 | // Verify wheter we have the model fully configured on the url configuration. |
| 81 | 81 | $this->guardModel($model); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // The model class name. |
| 101 | 101 | $className = get_class($model); |
| 102 | 102 | |
| 103 | - if (! $this->urlConf->has($className)) { |
|
| 103 | + if (!$this->urlConf->has($className)) { |
|
| 104 | 104 | throw new NoModelConfException("Model [{$className}] is not configured. Check your lincable url configuration."); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param array $params |
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | - protected function setModelFormatters(array $customParams = []) |
|
| 118 | + protected function setModelFormatters(array $customParams = [ ]) |
|
| 119 | 119 | { |
| 120 | 120 | $attributes = $this->getModel()->getAttributes(); |
| 121 | 121 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function generate() |
| 138 | 138 | { |
| 139 | - return $this->availableParsers->reduce(function ($url, Parser $parser) { |
|
| 139 | + return $this->availableParsers->reduce(function($url, Parser $parser) { |
|
| 140 | 140 | |
| 141 | 141 | // Set the compiler current parser. |
| 142 | 142 | $this->compiler->setParser($parser); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $url = $this->getRawUrl(); |
| 252 | 252 | |
| 253 | 253 | // Get all dynamic parameters on url from model parsers. |
| 254 | - $dynamics = $this->availableParsers->map(function (Parser $parser) use ($url) { |
|
| 254 | + $dynamics = $this->availableParsers->map(function(Parser $parser) use ($url) { |
|
| 255 | 255 | |
| 256 | 256 | // Set the current parser. |
| 257 | 257 | $this->compiler->setParser($parser); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | return $this->compiler->parseDynamics($url); |
| 260 | 260 | })->flatten()->all(); |
| 261 | 261 | |
| 262 | - return array_filter($parameters, function ($key) use ($dynamics) { |
|
| 262 | + return array_filter($parameters, function($key) use ($dynamics) { |
|
| 263 | 263 | return in_array($key, $dynamics); |
| 264 | 264 | }, ARRAY_FILTER_USE_KEY); |
| 265 | 265 | } |
@@ -272,18 +272,18 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | protected function injectFormatterToAvailableParsers(array $dynamicParameters) |
| 274 | 274 | { |
| 275 | - $this->availableParsers->each(function (Parser $parser) use ($dynamicParameters) { |
|
| 275 | + $this->availableParsers->each(function(Parser $parser) use ($dynamicParameters) { |
|
| 276 | 276 | foreach ($dynamicParameters as $key => $value) { |
| 277 | 277 | |
| 278 | 278 | // Register the formatter for the key, and the logic function is to return |
| 279 | - $parser->addFormatter(function () use ($value, $parser) { |
|
| 279 | + $parser->addFormatter(function() use ($value, $parser) { |
|
| 280 | 280 | if ($this->parameterResolver) { |
| 281 | 281 | |
| 282 | 282 | // Get the container instance on parser class. |
| 283 | 283 | $container = $parser->getContainer(); |
| 284 | 284 | |
| 285 | 285 | // Call the parameter resolver for the value returned. |
| 286 | - $value = $container->call($this->parameterResolver, [$value]); |
|
| 286 | + $value = $container->call($this->parameterResolver, [ $value ]); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | return $value; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $url = $this->getRawUrl(); |
| 304 | 304 | |
| 305 | 305 | // Get parsers that has dynamic parameters for model url. |
| 306 | - $availableParsers = $this->parsers->filter(function (Parser $parser) use ($url) { |
|
| 306 | + $availableParsers = $this->parsers->filter(function(Parser $parser) use ($url) { |
|
| 307 | 307 | |
| 308 | 308 | // Change the current compiler parser. |
| 309 | 309 | $this->compiler->setParser($parser); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function compile(string $url): string |
| 35 | 35 | { |
| 36 | 36 | // Parse each fragment on url. |
| 37 | - $fragments = array_map(function ($fragment) { |
|
| 37 | + $fragments = array_map(function($fragment) { |
|
| 38 | 38 | if ($this->getParser()->isParameterDynamic($fragment)) { |
| 39 | 39 | |
| 40 | 40 | // We assume the parameter fragment is dynamic for |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $fragments = $this->parseUrlFragments($url); |
| 60 | 60 | |
| 61 | - $dynamicParameters = array_filter($fragments, function ($parameter) { |
|
| 61 | + $dynamicParameters = array_filter($fragments, function($parameter) { |
|
| 62 | 62 | |
| 63 | 63 | // Determine wheter the parameter is dynamic on parser |
| 64 | 64 | // and should be kept. |
| 65 | 65 | return $this->getParser()->isParameterDynamic($parameter); |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - return array_map(function ($parameter) { |
|
| 68 | + return array_map(function($parameter) { |
|
| 69 | 69 | |
| 70 | 70 | // Return the matches for the dynamic parameter. |
| 71 | 71 | return $this->getParser()->getMatches($parameter); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function hasDynamics(string $url): bool |
| 82 | 82 | { |
| 83 | - return ! empty(array_values($this->parseDynamics($url))); |
|
| 83 | + return !empty(array_values($this->parseDynamics($url))); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | // Get the global container instance. |
| 68 | 68 | $app = Container::getInstance(); |
| 69 | 69 | |
| 70 | - if (! $file->isBooted()) { |
|
| 70 | + if (!$file->isBooted()) { |
|
| 71 | 71 | |
| 72 | 72 | // Boot the file request with the current request. |
| 73 | 73 | $file->boot($app->make(Request::class)); |
@@ -142,6 +142,4 @@ |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // Re-set the original fillables. |
| 145 | - $this->fillable($originalFillables); |
|
| 146 | - } |
|
| 147 | -} |
|
| 145 | + $this->fillable($originalFillables |
|
| 148 | 146 | \ No newline at end of file |
@@ -142,6 +142,4 @@ |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // Re-set the original fillables. |
| 145 | - $this->fillable($originalFillables); |
|
| 146 | - } |
|
| 147 | -} |
|
| 145 | + $this->fillable($originalFillables |
|
| 148 | 146 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | namespace Lincable\Eloquent; |
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\File; |
| 6 | -<<<<<<< HEAD |
|
| 6 | +<< << <<< HEAD |
|
| 7 | 7 | ======= |
| 8 | 8 | use Lincable\UrlGenerator; |
| 9 | 9 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
@@ -142,6 +142,4 @@ discard block |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // Re-set the original fillables. |
| 145 | - $this->fillable($originalFillables); |
|
| 146 | - } |
|
| 147 | -} |
|
| 145 | + $this->fillable($originalFillables |
|
| 148 | 146 | \ No newline at end of file |
@@ -142,6 +142,4 @@ |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // Re-set the original fillables. |
| 145 | - $this->fillable($originalFillables); |
|
| 146 | - } |
|
| 147 | -} |
|
| 145 | + $this->fillable($originalFillables |
|
| 148 | 146 | \ No newline at end of file |
@@ -142,6 +142,4 @@ |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // Re-set the original fillables. |
| 145 | - $this->fillable($originalFillables); |
|
| 146 | - } |
|
| 147 | -} |
|
| 145 | + $this->fillable($originalFillables |
|
| 148 | 146 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @var array |
| 17 | 17 | */ |
| 18 | - protected $configuration = []; |
|
| 18 | + protected $configuration = [ ]; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * The base namespace for the models. |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function has($key) |
| 45 | 45 | { |
| 46 | - return isset($this->configuration[$key]); |
|
| 46 | + return isset($this->configuration[ $key ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function get($key, $default = null) |
| 57 | 57 | { |
| 58 | - return $this->has($key) ? $this->configuration[$key] : $default; |
|
| 58 | + return $this->has($key) ? $this->configuration[ $key ] : $default; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $key = $this->getModelFromKey($key); |
| 90 | 90 | |
| 91 | 91 | // Set the configuration. |
| 92 | - $this->configuration[$key] = $value; |
|
| 92 | + $this->configuration[ $key ] = $value; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $model = $key; |
| 146 | 146 | |
| 147 | - if (str_contains($key, '.') || ! str_contains($key, '\\')) { |
|
| 147 | + if (str_contains($key, '.') || !str_contains($key, '\\')) { |
|
| 148 | 148 | |
| 149 | 149 | // Build the class namespace using the base model namespace |
| 150 | 150 | // and the parts of the key splitted by dots. |
| 151 | 151 | $model = $this->buildNamespace(array_merge( |
| 152 | - [$this->modelsNamespace], |
|
| 152 | + [ $this->modelsNamespace ], |
|
| 153 | 153 | array_map('ucfirst', explode('.', $key)) |
| 154 | 154 | )); |
| 155 | 155 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function setDisk(string $disk) |
| 109 | 109 | { |
| 110 | - $this->disk = $this->app['filesystem']->disk($disk); |
|
| 110 | + $this->disk = $this->app[ 'filesystem' ]->disk($disk); |
|
| 111 | 111 | |
| 112 | 112 | return $this; |
| 113 | 113 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param mixed $formatters |
| 133 | 133 | * @return this |
| 134 | 134 | */ |
| 135 | - public function addParser($parser, $formatters = []) |
|
| 135 | + public function addParser($parser, $formatters = [ ]) |
|
| 136 | 136 | { |
| 137 | 137 | if (is_string($parser)) { |
| 138 | 138 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $parser = $this->app->make($parser); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if (! $parser instanceof Parser) { |
|
| 143 | + if (!$parser instanceof Parser) { |
|
| 144 | 144 | $type = gettype($parser); |
| 145 | 145 | |
| 146 | 146 | // Force the parser to be a Parser class. |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Create the default parsers from config. |
| 175 | 175 | $parsers = array_merge( |
| 176 | - $this->getConfig('default_parsers', []), |
|
| 177 | - $this->getConfig('parsers', []) |
|
| 176 | + $this->getConfig('default_parsers', [ ]), |
|
| 177 | + $this->getConfig('parsers', [ ]) |
|
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | 180 | foreach ($parsers as $parser => $formatters) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Create a new disk filesystem. |
| 185 | - $this->disk = $this->app['filesystem']->disk($this->getConfig('disk')); |
|
| 185 | + $this->disk = $this->app[ 'filesystem' ]->disk($this->getConfig('disk')); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | protected function getConfig(string $key, $default = null) |
| 196 | 196 | { |
| 197 | - return $this->app['config']["lincable.{$key}"] ?? $default; |
|
| 197 | + return $this->app[ 'config' ][ "lincable.{$key}" ] ?? $default; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Add the url configuration. |
| 221 | - foreach ($this->getConfig('urls', []) as $model => $url) { |
|
| 221 | + foreach ($this->getConfig('urls', [ ]) as $model => $url) { |
|
| 222 | 222 | $url = str_start($url, '/'); |
| 223 | 223 | |
| 224 | 224 | // Push the new mode url configuration. |
@@ -50,16 +50,4 @@ |
||
| 50 | 50 | ======= |
| 51 | 51 | |
| 52 | 52 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
| 53 | - $this->app['events']->subscribe($this->app['config']['lincable.upload_subscriber']); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Get the services provided by the provider. |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function provides() |
|
| 62 | - { |
|
| 63 | - return [MediaManager::class]; |
|
| 64 | - } |
|
| 65 | -} |
|
| 53 | + $this->app['events']->subscribe($this->app |
|
| 66 | 54 | \ No newline at end of file |
@@ -50,16 +50,4 @@ |
||
| 50 | 50 | ======= |
| 51 | 51 | |
| 52 | 52 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
| 53 | - $this->app['events']->subscribe($this->app['config']['lincable.upload_subscriber']); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Get the services provided by the provider. |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function provides() |
|
| 62 | - { |
|
| 63 | - return [MediaManager::class]; |
|
| 64 | - } |
|
| 65 | -} |
|
| 53 | + $this->app['events']->subscribe($this->app |
|
| 66 | 54 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function boot() |
| 24 | 24 | { |
| 25 | 25 | $configPath = __DIR__.'/../../../config/lincable.php'; |
| 26 | -<<<<<<< HEAD |
|
| 26 | +<< << <<< HEAD |
|
| 27 | 27 | |
| 28 | 28 | ======= |
| 29 | 29 | |
@@ -50,16 +50,4 @@ discard block |
||
| 50 | 50 | ======= |
| 51 | 51 | |
| 52 | 52 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
| 53 | - $this->app['events']->subscribe($this->app['config']['lincable.upload_subscriber']); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Get the services provided by the provider. |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function provides() |
|
| 62 | - { |
|
| 63 | - return [MediaManager::class]; |
|
| 64 | - } |
|
| 65 | -} |
|
| 53 | + $this->app['events']->subscribe($this->app |
|
| 66 | 54 | \ No newline at end of file |
@@ -50,16 +50,4 @@ |
||
| 50 | 50 | ======= |
| 51 | 51 | |
| 52 | 52 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
| 53 | - $this->app['events']->subscribe($this->app['config']['lincable.upload_subscriber']); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Get the services provided by the provider. |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function provides() |
|
| 62 | - { |
|
| 63 | - return [MediaManager::class]; |
|
| 64 | - } |
|
| 65 | -} |
|
| 53 | + $this->app['events']->subscribe($this->app |
|
| 66 | 54 | \ No newline at end of file |
@@ -50,16 +50,4 @@ |
||
| 50 | 50 | ======= |
| 51 | 51 | |
| 52 | 52 | >>>>>>> 4c8a26f5a973bebf5b69c343119e2161a489f17b |
| 53 | - $this->app['events']->subscribe($this->app['config']['lincable.upload_subscriber']); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Get the services provided by the provider. |
|
| 58 | - * |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function provides() |
|
| 62 | - { |
|
| 63 | - return [MediaManager::class]; |
|
| 64 | - } |
|
| 65 | -} |
|
| 53 | + $this->app['events']->subscribe($this->app |
|
| 66 | 54 | \ No newline at end of file |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function addFormatters($formatters) |
| 106 | 106 | { |
| 107 | - array_walk($formatters, function ($formatter, $name) { |
|
| 107 | + array_walk($formatters, function($formatter, $name) { |
|
| 108 | 108 | $this->addFormatter($formatter, is_int($name) ? null : $name); |
| 109 | 109 | }); |
| 110 | 110 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param array $params |
| 215 | 215 | * @return mixed |
| 216 | 216 | */ |
| 217 | - protected function callFormatter($formatter, array $params = []) |
|
| 217 | + protected function callFormatter($formatter, array $params = [ ]) |
|
| 218 | 218 | { |
| 219 | 219 | return $this->getContainer()->call($formatter, $params); |
| 220 | 220 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $formatter = $this->getContainer()->make($formatter); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - return [$formatter, 'format']; |
|
| 242 | + return [ $formatter, 'format' ]; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |