Skip to content

Commit

Permalink
Remove deprecated Laravel helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Sep 5, 2019
1 parent b9eff7c commit 169cfbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Caffeinated\Menus;

use BadMethodCallException;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

class Builder
Expand Down Expand Up @@ -92,7 +93,7 @@ public function extractAttributes($options = array())
$options = $this->mergeWithLastGroup($options);
}

return array_except($options, $this->reserved);
return Arr::except($options, $this->reserved);
}

return array();
Expand Down Expand Up @@ -132,7 +133,7 @@ public function config($key)
public function getLastGroupPrefix()
{
if (count($this->groupStack) > 0) {
return array_get(last($this->groupStack), 'prefix', '');
return Arr::get(last($this->groupStack), 'prefix', '');
}

return null;
Expand All @@ -146,12 +147,12 @@ public function getLastGroupPrefix()
public static function formatGroupClass($new, $old)
{
if (isset($new['class'])) {
$classes = trim(trim(array_get($old, 'class')).' '.trim(array_get($new, 'class')));
$classes = trim(trim(Arr::get($old, 'class')).' '.trim(Arr::get($new, 'class')));

return implode(' ', array_unique(explode(' ', $classes)));
}

return array_get($old, 'class');
return Arr::get($old, 'class');
}

/*
Expand Down
6 changes: 4 additions & 2 deletions src/Item.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Caffeinated\Menus;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Request;

class Item
Expand Down Expand Up @@ -58,7 +60,7 @@ public function __construct($builder, $id, $title, $options)
$this->builder = $builder;
$this->id = $id;
$this->title = $title;
$this->slug = camel_case(str_slug($title, ' '));
$this->slug = Str::camel(Str::slug($title, ' '));
$this->attributes = $this->builder->extractAttributes($options);
$this->parent = (is_array($options) and isset($options['parent'])) ? $options['parent'] : null;

Expand All @@ -83,7 +85,7 @@ public function configureLink($options)
} elseif (isset($options['raw']) and $options['raw'] == true) {
$path = null;
} else {
$path = array_only($options, ['url', 'route', 'action', 'secure']);
$path = Arr::only($options, ['url', 'route', 'action', 'secure']);
}

if (! is_null($path)) {
Expand Down

0 comments on commit 169cfbc

Please sign in to comment.