Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Commit

Permalink
Swap out Str facade with helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Mar 21, 2016
1 parent dd73088 commit 3c7cacb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/Twig/Extensions/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Caffeinated\Sapling\Twig\Extensions;

use Collective\Html\FormBuilder;
use Illuminate\Support\Str;
use Twig_Extension;
use Twig_SimpleFunction;

Expand Down Expand Up @@ -43,10 +42,10 @@ public function getFunctions()
return [
new Twig_SimpleFunction('form_*', function($name) {
$arguments = array_slice(func_get_args(), 1);
$name = Str::camel($name);
$name = camel_case($name);

return call_user_func_array([$this->form, $name], $arguments);
}, ['is_safe' => ['html']]),
];
}
}
}
5 changes: 2 additions & 3 deletions src/Twig/Extensions/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Caffeinated\Sapling\Twig\Extensions;

use Collective\Html\HtmlBuilder;
use Illuminate\Support\Str;
use Twig_Extension;
use Twig_SimpleFunction;

Expand Down Expand Up @@ -47,10 +46,10 @@ public function getFunctions()
new Twig_SimpleFunction('link_to_action', [$this->html, 'linkAction'], ['is_safe' => ['html']]),
new Twig_SimpleFunction('html_*', function($name) {
$arguments = array_slice(func_get_args(), 1);
$name = Str::camel($name);
$name = camel_case($name);

return call_user_func_array([$this->html, $name], $arguments);
}, ['is_safe' => ['html']]),
];
}
}
}
5 changes: 2 additions & 3 deletions src/Twig/Extensions/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use Twig_Extension;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use Illuminate\Support\Str as IlluminateStr;

class Str extends Twig_Extension
{
Expand Down Expand Up @@ -56,7 +55,7 @@ public function getFunctions()
new Twig_SimpleFunction('starts_with', [$this->callback, 'startsWith']),
new Twig_SimpleFunction('str_*', function($name) {
$arguments = array_slice(func_get_args(), 1);
$name = IlluminateStr::camel($name);
$name = camel_case($name);

return call_user_func_array([$this->callback, $name], $arguments);
}),
Expand All @@ -76,7 +75,7 @@ public function getFilters()
new Twig_SimpleFilter('studly_case', [$this->callback, 'studly']),
new Twig_SimpleFilter('str_*', function($name) {
$arguments = array_slice(func_get_args(), 1);
$name = IlluminateStr::camel($name);
$name = camel_case($name);

return call_user_func_array([$this->callback, $name], $arguments);
}),
Expand Down

0 comments on commit 3c7cacb

Please sign in to comment.