Skip to content

Commit

Permalink
Removing deprications
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Szymeczko committed Feb 21, 2018
1 parent 4ba31de commit a25865e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Twig/JobQueueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@

class JobQueueExtension extends \Twig_Extension
{
private $linkGenerators = array();
private $linkGenerators = [];

public function __construct(array $generators = array())
public function __construct(array $generators = [])
{
$this->linkGenerators = $generators;
}

public function getTests()
{
return array(
'jms_job_queue_linkable' => new \Twig_Test_Method($this, 'isLinkable'),
);
return [
new \Twig_SimpleTest('jms_job_queue_linkable', 'isLinkable'),
];
}

public function getFunctions()
{
return array(
'jms_job_queue_path' => new \Twig_Function_Method($this, 'generatePath', array('is_safe' => array('html' => true))),
);
return [
new \Twig_SimpleFunction('jms_job_queue_path', 'generatePath', ['is_safe' => ['html' => true]]),
];
}

public function getFilters()
{
return array(
'jms_job_queue_linkname' => new \Twig_Filter_Method($this, 'getLinkname'),
'jms_job_queue_args' => new \Twig_Filter_Method($this, 'formatArgs'),
);
return [
new \Twig_SimpleFilter('jms_job_queue_linkname', 'getLinkname'),
new \Twig_SimpleFilter('jms_job_queue_args', 'formatArgs'),
];
}

public function formatArgs(array $args, $maxLength = 60)
Expand All @@ -40,13 +40,13 @@ public function formatArgs(array $args, $maxLength = 60)
foreach ($args as $arg) {
$argLength = strlen($arg);

if ( ! $first) {
if (!$first) {
$str .= ' ';
}
$first = false;

if (strlen($str) + $argLength > $maxLength) {
$str .= substr($arg, 0, $maxLength - strlen($str) - 4).'...';
$str .= substr($arg, 0, $maxLength - strlen($str) - 4) . '...';
break;
}

Expand Down Expand Up @@ -93,4 +93,4 @@ public function getName()
{
return 'jms_job_queue';
}
}
}

0 comments on commit a25865e

Please sign in to comment.