Skip to content

Commit 213d177

Browse files
committed
Merge branch 'develop'
2 parents dc2f931 + a48de99 commit 213d177

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"php": ">=5.4"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "5.7.*"
16+
"phpunit/phpunit": "4.8.*"
1717
},
1818
"autoload": {
1919
"psr-4": {

src/Eusonlito/LaravelMeta/FixesTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait FixesTrait
77
* @param string $text
88
* @return string
99
*/
10-
private function plain($text)
10+
protected function plain($text)
1111
{
1212
return trim(str_replace('"', '"', preg_replace('/[\r\n\s]+/', ' ', strip_tags($text))));
1313
}
@@ -17,7 +17,7 @@ private function plain($text)
1717
* @param string $key
1818
* @return string
1919
*/
20-
private function cut($text, $key)
20+
protected function cut($text, $key)
2121
{
2222
if (empty($text) || !is_string($text)) {
2323
return $text;

src/Eusonlito/LaravelMeta/Meta.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ class Meta
88
/**
99
* @var array
1010
*/
11-
private $config = [];
11+
protected $config = [];
1212

1313
/**
1414
* @var array
1515
*/
16-
private $metas = [];
16+
protected $metas = [];
1717

1818
/**
1919
* @var string
2020
*/
21-
private $title;
21+
protected $title;
2222

2323
/**
2424
* @var array
2525
*/
26-
private $defaults = [
26+
protected $defaults = [
2727
'title_limit' => 70,
2828
'description_limit' => 200,
2929
'image_limit' => 5,
@@ -33,10 +33,10 @@ class Meta
3333
/**
3434
* @var object;
3535
*/
36-
private static $instance;
36+
protected static $instance;
3737

3838
/**
39-
* @param array $config
39+
* @param array $config = []
4040
* @return object
4141
*/
4242
public static function getInstance(array $config = [])
@@ -45,23 +45,21 @@ public static function getInstance(array $config = [])
4545
}
4646

4747
/**
48-
* @param array $config
48+
* @param array $config = []
4949
*
5050
* @return this
5151
*/
5252
public function __construct($config = [])
5353
{
54-
if ($config) {
54+
if (!empty($config)) {
5555
$this->setConfig($config);
5656
}
5757

5858
$this->metas['image'] = [];
59-
60-
return $this;
6159
}
6260

6361
/**
64-
* @param array $config
62+
* @param array $config = []
6563
*
6664
* @return this
6765
*/
@@ -81,7 +79,7 @@ public function setConfig(array $config = [])
8179
}
8280

8381
/**
84-
* @param string $title
82+
* @param string|null $title = null
8583
*
8684
* @return string
8785
*/
@@ -133,7 +131,7 @@ public function remove($key)
133131
*
134132
* @return string
135133
*/
136-
private function setTitle($value)
134+
protected function setTitle($value)
137135
{
138136
$title = $this->title;
139137

@@ -152,10 +150,10 @@ private function setTitle($value)
152150
*
153151
* @return string
154152
*/
155-
private function setImage($value)
153+
protected function setImage($value)
156154
{
157155
if (count($this->metas['image']) >= $this->config['image_limit']) {
158-
return;
156+
return '';
159157
}
160158

161159
$this->metas['image'][] = $value;
@@ -166,18 +164,18 @@ private function setImage($value)
166164
/**
167165
* @return void
168166
*/
169-
private function removeImage()
167+
protected function removeImage()
170168
{
171169
$this->metas['image'] = [];
172170
}
173171

174172
/**
175173
* @param string $key
176-
* @param string|array $default
174+
* @param string|array $default = ''
177175
*
178-
* @return string
176+
* @return string|array
179177
*/
180-
public function get($key, $default = null)
178+
public function get($key, $default = '')
181179
{
182180
$method = 'get'.$key;
183181

@@ -195,7 +193,7 @@ public function get($key, $default = null)
195193
/**
196194
* @param string|array $default
197195
*
198-
* @return string
196+
* @return array
199197
*/
200198
public function getImage($default)
201199
{
@@ -210,11 +208,11 @@ public function getImage($default)
210208

211209
/**
212210
* @param string $key
213-
* @param string|array $default
211+
* @param string|array $default = ''
214212
*
215213
* @return string
216214
*/
217-
public function tag($key, $default = null)
215+
public function tag($key, $default = '')
218216
{
219217
if (!($values = $this->get($key, $default))) {
220218
return '';
@@ -238,7 +236,7 @@ public function tag($key, $default = null)
238236
}
239237

240238
/**
241-
* @param string $key
239+
* @param array $keys = []
242240
*
243241
* @return string
244242
*/

0 commit comments

Comments
 (0)