@@ -6,6 +6,7 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | 8 | * Configure default settings. |
| 9 | + * @return void |
|
| 9 | 10 | */ |
| 10 | 11 | public function __construct(); |
| 11 | 12 | |
@@ -13,6 +14,7 @@ discard block |
||
| 13 | 14 | * Sets the favicons directory. |
| 14 | 15 | * |
| 15 | 16 | * @param string $url |
| 17 | + * @return \Pyncil\SEO\Favicons |
|
| 16 | 18 | */ |
| 17 | 19 | public function set($url = '/'); |
| 18 | 20 | |
@@ -20,6 +22,7 @@ discard block |
||
| 20 | 22 | * Set colors for certain favicons. |
| 21 | 23 | * |
| 22 | 24 | * @param array $colors |
| 25 | + * @return \Pyncil\SEO\Favicons |
|
| 23 | 26 | */ |
| 24 | 27 | public function setColors($colors); |
| 25 | 28 | |
@@ -27,6 +30,7 @@ discard block |
||
| 27 | 30 | * Set general favicon sizes. |
| 28 | 31 | * |
| 29 | 32 | * @param array $sizes |
| 33 | + * @return \Pyncil\SEO\Favicons |
|
| 30 | 34 | */ |
| 31 | 35 | public function setSizes($sizes); |
| 32 | 36 | |
@@ -34,6 +38,7 @@ discard block |
||
| 34 | 38 | * Set Apple Touch sizes. |
| 35 | 39 | * |
| 36 | 40 | * @param array $sizes |
| 41 | + * @return \Pyncil\SEO\Favicons |
|
| 37 | 42 | */ |
| 38 | 43 | public function setAppleSizes($sizes); |
| 39 | 44 | |
@@ -41,13 +46,13 @@ discard block |
||
| 41 | 46 | * Set Android sizes. |
| 42 | 47 | * |
| 43 | 48 | * @param array $sizes |
| 49 | + * @return \Pyncil\SEO\Favicons |
|
| 44 | 50 | */ |
| 45 | 51 | public function setAndroidSizes($sizes); |
| 46 | 52 | |
| 47 | 53 | /** |
| 48 | 54 | * Generate favicon HTML based on existing images. |
| 49 | 55 | * |
| 50 | - * @param string $dir Directory the favicons exist in |
|
| 51 | 56 | * |
| 52 | 57 | * @return string |
| 53 | 58 | */ |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Set general favicon sizes. |
| 90 | 90 | * |
| 91 | - * @param array $sizes |
|
| 91 | + * @param string[] $sizes |
|
| 92 | 92 | */ |
| 93 | 93 | public function setSizes($sizes) |
| 94 | 94 | { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * Set Apple Touch sizes. |
| 102 | 102 | * |
| 103 | - * @param array $sizes |
|
| 103 | + * @param string[] $sizes |
|
| 104 | 104 | */ |
| 105 | 105 | public function setAppleSizes($sizes) |
| 106 | 106 | { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * Set Android sizes. |
| 114 | 114 | * |
| 115 | - * @param array $sizes |
|
| 115 | + * @param string[] $sizes |
|
| 116 | 116 | */ |
| 117 | 117 | public function setAndroidSizes($sizes) |
| 118 | 118 | { |
@@ -124,7 +124,6 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Generate favicon HTML based on existing images. |
| 126 | 126 | * |
| 127 | - * @param string $dir Directory the favicons exist in |
|
| 128 | 127 | * |
| 129 | 128 | * @return string |
| 130 | 129 | */ |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setColors($colors) |
| 80 | 80 | { |
| 81 | - foreach($colors as $name => $color) { |
|
| 81 | + foreach ($colors as $name => $color) { |
|
| 82 | 82 | $this->colors[$name] = $color; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -134,51 +134,51 @@ discard block |
||
| 134 | 134 | $colors = $this->getColors(); |
| 135 | 135 | |
| 136 | 136 | return !empty($dir) ? |
| 137 | - $this->insertWith($this->getAppleSizes(), function ($insert) use ($dir) { |
|
| 138 | - return '<link rel="apple-touch-icon" sizes="' . $insert . '" href="' . asset($dir . 'apple-touch-icon-' . $insert . '.png').'">'; |
|
| 139 | - }, function ($insert) use ($dir) { |
|
| 140 | - return File::exists(public_path($dir.'apple-touch-icon-'.$insert.'.png')); |
|
| 137 | + $this->insertWith($this->getAppleSizes(), function($insert) use ($dir) { |
|
| 138 | + return '<link rel="apple-touch-icon" sizes="' . $insert . '" href="' . asset($dir . 'apple-touch-icon-' . $insert . '.png') . '">'; |
|
| 139 | + }, function($insert) use ($dir) { |
|
| 140 | + return File::exists(public_path($dir . 'apple-touch-icon-' . $insert . '.png')); |
|
| 141 | 141 | }) . |
| 142 | - $this->insertWith($this->getSizes(), function ($insert) use ($dir) { |
|
| 143 | - return '<link rel="icon" type="image/png" href="' . asset($dir . 'favicon-' . $insert . '.png').'" sizes="'.$insert.'">'; |
|
| 144 | - }, function ($insert) use ($dir) { |
|
| 145 | - return File::exists(public_path($dir.'favicon-'.$insert.'.png')); |
|
| 142 | + $this->insertWith($this->getSizes(), function($insert) use ($dir) { |
|
| 143 | + return '<link rel="icon" type="image/png" href="' . asset($dir . 'favicon-' . $insert . '.png') . '" sizes="' . $insert . '">'; |
|
| 144 | + }, function($insert) use ($dir) { |
|
| 145 | + return File::exists(public_path($dir . 'favicon-' . $insert . '.png')); |
|
| 146 | 146 | }) . |
| 147 | - $this->insertWith($this->getAndroidSizes(), function ($insert) use ($dir) { |
|
| 148 | - return '<link rel="icon" type="image/png" href="' . asset($dir . 'android-chrome-' . $insert . '.png').'" sizes="'.$insert.'">'; |
|
| 149 | - }, function ($insert) use ($dir) { |
|
| 150 | - return File::exists(public_path($dir.'android-chrome-'.$insert.'.png')); |
|
| 147 | + $this->insertWith($this->getAndroidSizes(), function($insert) use ($dir) { |
|
| 148 | + return '<link rel="icon" type="image/png" href="' . asset($dir . 'android-chrome-' . $insert . '.png') . '" sizes="' . $insert . '">'; |
|
| 149 | + }, function($insert) use ($dir) { |
|
| 150 | + return File::exists(public_path($dir . 'android-chrome-' . $insert . '.png')); |
|
| 151 | 151 | }) . |
| 152 | - $this->insertWith($dir.'/manifest.json', function ($insert) { |
|
| 152 | + $this->insertWith($dir . '/manifest.json', function($insert) { |
|
| 153 | 153 | return '<link rel="manifest" href="' . asset($insert) . '">'; |
| 154 | - }, function ($insert) { |
|
| 154 | + }, function($insert) { |
|
| 155 | 155 | return File::exists(public_path($insert)); |
| 156 | 156 | }) . |
| 157 | - $this->insertWith($dir.'/safari-pinned-tab.svg', function ($insert) use ($colors) { |
|
| 158 | - return '<link rel="mask-icon" href="'.asset($insert).'" color="' . $colors['safari_pinned'] . '">'; |
|
| 159 | - }, function ($insert) { |
|
| 157 | + $this->insertWith($dir . '/safari-pinned-tab.svg', function($insert) use ($colors) { |
|
| 158 | + return '<link rel="mask-icon" href="' . asset($insert) . '" color="' . $colors['safari_pinned'] . '">'; |
|
| 159 | + }, function($insert) { |
|
| 160 | 160 | return File::exists(public_path($insert)); |
| 161 | 161 | }) . |
| 162 | - $this->insertWith($dir.'/favicon.ico', function ($insert) { |
|
| 163 | - return '<link rel="shortcut icon" href="'.asset($insert).'">'; |
|
| 164 | - }, function ($insert) { |
|
| 162 | + $this->insertWith($dir . '/favicon.ico', function($insert) { |
|
| 163 | + return '<link rel="shortcut icon" href="' . asset($insert) . '">'; |
|
| 164 | + }, function($insert) { |
|
| 165 | 165 | return File::exists(public_path($insert)); |
| 166 | 166 | }) . |
| 167 | - $this->insertWith($dir.'/mstile-144x144.png', function ($insert) { |
|
| 168 | - return '<meta name="msapplication-TileImage" content="'.asset($insert).'">'; |
|
| 169 | - }, function ($insert) { |
|
| 167 | + $this->insertWith($dir . '/mstile-144x144.png', function($insert) { |
|
| 168 | + return '<meta name="msapplication-TileImage" content="' . asset($insert) . '">'; |
|
| 169 | + }, function($insert) { |
|
| 170 | 170 | return File::exists(public_path($insert)); |
| 171 | 171 | }) . |
| 172 | - $this->insertWith($dir.'/browserconfig.xml', function ($insert) { |
|
| 173 | - return '<meta name="msapplication-config" content="'.asset($insert).'">'; |
|
| 174 | - }, function ($insert) { |
|
| 172 | + $this->insertWith($dir . '/browserconfig.xml', function($insert) { |
|
| 173 | + return '<meta name="msapplication-config" content="' . asset($insert) . '">'; |
|
| 174 | + }, function($insert) { |
|
| 175 | 175 | return File::exists(public_path($insert)); |
| 176 | 176 | }) . |
| 177 | - $this->insertWith($colors['ms_tile'], function ($insert) { |
|
| 178 | - return '<meta name="msapplication-TileColor" content="'.$insert.'">'; |
|
| 177 | + $this->insertWith($colors['ms_tile'], function($insert) { |
|
| 178 | + return '<meta name="msapplication-TileColor" content="' . $insert . '">'; |
|
| 179 | 179 | }) . |
| 180 | - $this->insertWith($colors['theme'], function ($insert) { |
|
| 181 | - return '<meta name="theme-color" content="'.$insert.'">'; |
|
| 180 | + $this->insertWith($colors['theme'], function($insert) { |
|
| 181 | + return '<meta name="theme-color" content="' . $insert . '">'; |
|
| 182 | 182 | }) : ''; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function register() |
| 26 | 26 | { |
| 27 | - $this->app->singleton('seo', function () { |
|
| 27 | + $this->app->singleton('seo', function() { |
|
| 28 | 28 | return new SEOGenerator(); |
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | - $this->app->singleton('seo.favicons', function () { |
|
| 31 | + $this->app->singleton('seo.favicons', function() { |
|
| 32 | 32 | return new Favicons(); |
| 33 | 33 | }); |
| 34 | 34 | |