diff --git a/composer.json b/composer.json index 902b5ce..21705e2 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "require": { "php": ">=7.1", "ext-json": "*", - "illuminate/config": "5.8.*", "illuminate/support": "5.8.*" }, "require-dev": { diff --git a/src/SEOTools/Contracts/MetaTags.php b/src/SEOTools/Contracts/MetaTags.php index bc6f254..53adc92 100644 --- a/src/SEOTools/Contracts/MetaTags.php +++ b/src/SEOTools/Contracts/MetaTags.php @@ -2,18 +2,8 @@ namespace Artesaos\SEOTools\Contracts; -use Illuminate\Config\Repository as Config; - interface MetaTags { - /** - * Configuration. - * - * @param \Illuminate\Config\Repository $config - * @return void - */ - public function __construct(Config $config); - /** * Generates meta tags. * diff --git a/src/SEOTools/Providers/SEOToolsServiceProvider.php b/src/SEOTools/Providers/SEOToolsServiceProvider.php index d2b0c0e..e3eaa6e 100644 --- a/src/SEOTools/Providers/SEOToolsServiceProvider.php +++ b/src/SEOTools/Providers/SEOToolsServiceProvider.php @@ -10,7 +10,6 @@ use Artesaos\SEOTools\OpenGraph; use Artesaos\SEOTools\TwitterCards; use Illuminate\Support\ServiceProvider; -use Illuminate\Config\Repository as Config; use Illuminate\Contracts\Support\DeferrableProvider; class SEOToolsServiceProvider extends ServiceProvider implements DeferrableProvider @@ -41,7 +40,7 @@ public function boot() public function register() { $this->app->singleton('seotools.metatags', function($app) { - return new SEOMeta(new Config($app['config']->get('seotools.meta', []))); + return new SEOMeta($app['config']->get('seotools.meta', [])); }); $this->app->singleton('seotools.opengraph', function($app) { diff --git a/src/SEOTools/SEOMeta.php b/src/SEOTools/SEOMeta.php index 072e7d9..6897486 100644 --- a/src/SEOTools/SEOMeta.php +++ b/src/SEOTools/SEOMeta.php @@ -3,7 +3,6 @@ namespace Artesaos\SEOTools; use Illuminate\Support\Arr; -use Illuminate\Config\Repository as Config; use Artesaos\SEOTools\Contracts\MetaTags as MetaTagsContract; class SEOMeta implements MetaTagsContract @@ -100,7 +99,7 @@ class SEOMeta implements MetaTagsContract protected $robots; /** - * @var Config + * @var array */ protected $config; @@ -118,9 +117,9 @@ class SEOMeta implements MetaTagsContract ]; /** - * @param \Illuminate\Config\Repository $config + * @param array $config */ - public function __construct(Config $config) + public function __construct(array $config = []) { $this->config = $config; } @@ -401,7 +400,7 @@ public function getTitle() public function getDefaultTitle() { if (empty($this->title_default)) { - return $this->config->get('defaults.title', null); + return Arr::get($this->config, 'defaults.title', null); } return $this->title_default; @@ -420,7 +419,7 @@ public function getTitleSession() */ public function getTitleSeparator() { - return $this->title_separator ?: $this->config->get('defaults.separator', ' - '); + return $this->title_separator ?: Arr::get($this->config, 'defaults.separator', ' - '); } /** @@ -428,7 +427,7 @@ public function getTitleSeparator() */ public function getKeywords() { - return $this->keywords ?: $this->config->get('defaults.keywords', []); + return $this->keywords ?: Arr::get($this->config, 'defaults.keywords', []); } /** @@ -448,7 +447,7 @@ public function getDescription() return; } - return $this->description ?: $this->config->get('defaults.description', null); + return $this->description ?: Arr::get($this->config, 'defaults.description', null); } /** @@ -456,7 +455,7 @@ public function getDescription() */ public function getCanonical() { - $canonical_config = $this->config->get('defaults.canonical', false); + $canonical_config = Arr::get($this->config, 'defaults.canonical', false); return $this->canonical ?: (($canonical_config === null) ? app('url')->full() : $canonical_config); } @@ -502,7 +501,7 @@ public function getAlternateLanguages() */ public function getRobots() { - return $this->robots ?: $this->config->get('defaults.robots', null); + return $this->robots ?: Arr::get($this->config, 'defaults.robots', null); } /** @@ -536,7 +535,7 @@ protected function parseTitle($title) if (empty($default)) { return $title; } - $defaultBefore = $this->config->get('defaults.titleBefore', false); + $defaultBefore = Arr::get($this->config, 'defaults.titleBefore', false); return $defaultBefore ? $default.$this->getTitleSeparator().$title : $title.$this->getTitleSeparator().$default; } @@ -546,7 +545,7 @@ protected function parseTitle($title) */ protected function loadWebMasterTags() { - foreach ($this->config->get('webmaster_tags', []) as $name => $value) { + foreach (Arr::get($this->config, 'webmaster_tags', []) as $name => $value) { if (!empty($value)) { $meta = Arr::get($this->webmasterTags, $name, $name); $this->addMeta($meta, $value);