Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
eusonlito committed May 5, 2018
2 parents dc2f931 + a48de99 commit 213d177
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "5.7.*"
"phpunit/phpunit": "4.8.*"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Eusonlito/LaravelMeta/FixesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait FixesTrait
* @param string $text
* @return string
*/
private function plain($text)
protected function plain($text)
{
return trim(str_replace('"', '"', preg_replace('/[\r\n\s]+/', ' ', strip_tags($text))));
}
Expand All @@ -17,7 +17,7 @@ private function plain($text)
* @param string $key
* @return string
*/
private function cut($text, $key)
protected function cut($text, $key)
{
if (empty($text) || !is_string($text)) {
return $text;
Expand Down
44 changes: 21 additions & 23 deletions src/Eusonlito/LaravelMeta/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ class Meta
/**
* @var array
*/
private $config = [];
protected $config = [];

/**
* @var array
*/
private $metas = [];
protected $metas = [];

/**
* @var string
*/
private $title;
protected $title;

/**
* @var array
*/
private $defaults = [
protected $defaults = [
'title_limit' => 70,
'description_limit' => 200,
'image_limit' => 5,
Expand All @@ -33,10 +33,10 @@ class Meta
/**
* @var object;
*/
private static $instance;
protected static $instance;

/**
* @param array $config
* @param array $config = []
* @return object
*/
public static function getInstance(array $config = [])
Expand All @@ -45,23 +45,21 @@ public static function getInstance(array $config = [])
}

/**
* @param array $config
* @param array $config = []
*
* @return this
*/
public function __construct($config = [])
{
if ($config) {
if (!empty($config)) {
$this->setConfig($config);
}

$this->metas['image'] = [];

return $this;
}

/**
* @param array $config
* @param array $config = []
*
* @return this
*/
Expand All @@ -81,7 +79,7 @@ public function setConfig(array $config = [])
}

/**
* @param string $title
* @param string|null $title = null
*
* @return string
*/
Expand Down Expand Up @@ -133,7 +131,7 @@ public function remove($key)
*
* @return string
*/
private function setTitle($value)
protected function setTitle($value)
{
$title = $this->title;

Expand All @@ -152,10 +150,10 @@ private function setTitle($value)
*
* @return string
*/
private function setImage($value)
protected function setImage($value)
{
if (count($this->metas['image']) >= $this->config['image_limit']) {
return;
return '';
}

$this->metas['image'][] = $value;
Expand All @@ -166,18 +164,18 @@ private function setImage($value)
/**
* @return void
*/
private function removeImage()
protected function removeImage()
{
$this->metas['image'] = [];
}

/**
* @param string $key
* @param string|array $default
* @param string|array $default = ''
*
* @return string
* @return string|array
*/
public function get($key, $default = null)
public function get($key, $default = '')
{
$method = 'get'.$key;

Expand All @@ -195,7 +193,7 @@ public function get($key, $default = null)
/**
* @param string|array $default
*
* @return string
* @return array
*/
public function getImage($default)
{
Expand All @@ -210,11 +208,11 @@ public function getImage($default)

/**
* @param string $key
* @param string|array $default
* @param string|array $default = ''
*
* @return string
*/
public function tag($key, $default = null)
public function tag($key, $default = '')
{
if (!($values = $this->get($key, $default))) {
return '';
Expand All @@ -238,7 +236,7 @@ public function tag($key, $default = null)
}

/**
* @param string $key
* @param array $keys = []
*
* @return string
*/
Expand Down

0 comments on commit 213d177

Please sign in to comment.