Skip to content

Commit

Permalink
Use short syntax array
Browse files Browse the repository at this point in the history
  • Loading branch information
shakaran committed Sep 17, 2017
1 parent 6d1893b commit f2e2c4c
Show file tree
Hide file tree
Showing 28 changed files with 195 additions and 195 deletions.
30 changes: 15 additions & 15 deletions Command/BuildAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function findFonts()
{
$finder = new Finder();
$finder->files()->in("$this->pubdir")->path('/fonts');
$fonts = array();
$fonts = [];
/** @var SplFileInfo $file */
foreach($finder as $file) {
if(isset($fonts[$file->getFilename()])) continue;
Expand All @@ -107,7 +107,7 @@ protected function processScript($name, $files, $fs, $in, $out)

$fs->exists($dir) or $fs->mkdir($dir);

$command = array($in->getOption('uglifyjs-bin'));
$command = [$in->getOption('uglifyjs-bin')];
if($in->getOption('compress'))
$command[] = "-c 'dead_code,drop_debugger,drop_console,keep_fargs,unused=false,properties=false'";
if($in->getOption('mangle'))
Expand Down Expand Up @@ -135,7 +135,7 @@ protected function processStyle($name, $files, $fs, $in, $out)

$fs->exists($dir) or $fs->mkdir($dir);

$command = array($in->getOption('uglifycss-bin'));
$command = [$in->getOption('uglifycss-bin')];
$command[] = implode(' ', $files);
$command[] = "> $file";

Expand Down Expand Up @@ -168,11 +168,11 @@ protected function isImage($file)

protected function resolveAll($assets)
{
$resolved = array();
$resolved = [];

foreach ($assets as $name => $inputs) {
if (!isset($resolved[$name])) {
$resolved[$name] = array();
$resolved[$name] = [];
}

foreach ($inputs['inputs'] as $input) {
Expand All @@ -185,13 +185,13 @@ protected function resolveAll($assets)

protected function partition($resolved)
{
$grouped = array(
'scripts' => array(),
'styles' => array(),
'images' => array(),
'files' => array(),
'fonts' => array()
);
$grouped = [
'scripts' => [],
'styles' => [],
'images' => [],
'files' => [],
'fonts' => []
];

foreach ($resolved as $group => $files) {
foreach ($files as $file) {
Expand All @@ -217,9 +217,9 @@ protected function partition($resolved)

protected function resolve($groups, $input)
{
$resolved = array();
$resolved = [];
if(strpos($input, '@') === false) {
return array($this->webdir . '/' . $input);
return [$this->webdir . '/' . $input];
}

$cleaned = str_replace('@', '', $input);
Expand All @@ -232,7 +232,7 @@ protected function resolve($groups, $input)
}

if(($star = strpos($input, '*')) === false) {
return array($this->kernel->locateResource($input));
return [$this->kernel->locateResource($input)];
} else {
$dir = $this->kernel->locateResource(substr($input, 0, $star));
$it = new \DirectoryIterator($dir);
Expand Down
16 changes: 8 additions & 8 deletions Command/CompactVendorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ protected function execute(InputInterface $input, OutputInterface $output) {
protected function getThemePath($type, InputInterface $input, $kernel) {
$theme = $input->getArgument('theme');
$themedir = strtr('@AvanzuAdminThemeBundle/Resources/vendor/bootflat/{type}',
array(
[
'{theme}' => $theme,
'{type}' => $type
));
]);
$vendors = $kernel->locateResource($themedir);

return $vendors;
Expand Down Expand Up @@ -111,13 +111,13 @@ protected function compressThemeCss(InputInterface $input, OutputInterface $outp
$public = dirname(dirname(dirname($vendors))) . '/public';
$script = $public . '/css/theme.min.css';

$files = array(
$files = [
dirname($vendors) . '/bootstrap/bootstrap.css'
,'font-awesome.css'
,'bootflat.css'
,'bootflat-extensions.css'
,'bootflat-square.css'
);
];

$process = new Process(sprintf('/usr/local/share/npm/bin/uglifycss %s > %s', implode(' ', $files), $script));
$output->writeln($helper->formatSection('Executing', $process->getCommandLine(), 'comment'));
Expand All @@ -142,10 +142,10 @@ protected function compressThemeJs(InputInterface $input, OutputInterface $outpu
$public = dirname(dirname(dirname($vendors))) . '/public';
$script = $public . '/js/theme.min.js';

$files = array(
$files = [
'bootstrap.js'
,'jquery.icheck.js'
);
];

$process = new Process(sprintf('/usr/local/bin/uglifyjs %s -c -m -o %s', implode(' ', $files), $script));
$output->writeln($helper->formatSection('Executing command', 'Compressing theme vendor scripts'));
Expand All @@ -171,7 +171,7 @@ protected function compressVendorJs(OutputInterface $output) {
$public = dirname($vendors) . '/public';
$script = $public . '/js/vendors.js';

$files = array(
$files = [
'jquery/dist/jquery.js'
, 'jquery-ui/jquery-ui.js'
, 'fastclick/lib/fastclick.js'
Expand All @@ -187,7 +187,7 @@ protected function compressVendorJs(OutputInterface $output) {
, 'spinjs/spin.js'
, 'spinjs/jquery.spin.js'
, 'holderjs/holder.js'
);
];

$process = new Process(sprintf('/usr/local/bin/uglifyjs %s -c -m -o %s', implode(' ', $files), $script));
$output->writeln($helper->formatSection('Executing command', 'Compressing general vendor scripts'));
Expand Down
6 changes: 3 additions & 3 deletions Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class ScriptHandler
* a composer.json and set new options, making them immediately available
* to forthcoming listeners.
*/
private static $options = array(
private static $options = [
'symfony-app-dir' => 'app',
'symfony-web-dir' => 'web'
);
];

protected static function getOptions(CommandEvent $event)
{
Expand Down Expand Up @@ -106,7 +106,7 @@ protected static function getConsoleDir(CommandEvent $event, $actionName)

protected static function getPhpArguments()
{
$arguments = array();
$arguments = [];

$phpFinder = new PhpExecutableFinder();
if (method_exists($phpFinder, 'findArguments')) {
Expand Down
6 changes: 3 additions & 3 deletions Controller/BreadcrumbController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function breadcrumbAction(Request $request, $title = '') {

$active = $this->getDispatcher()->dispatch(ThemeEvents::THEME_BREADCRUMB, new SidebarMenuEvent($request))->getActive();
/** @var $active MenuItemInterface */
$list = array();
$list = [];
if($active) {
$list[] = $active;
while(null !== ($item = $active->getActiveChild())) {
Expand All @@ -48,10 +48,10 @@ public function breadcrumbAction(Request $request, $title = '') {
}
}

return $this->render('AvanzuAdminThemeBundle:Breadcrumb:breadcrumb.html.twig', array(
return $this->render('AvanzuAdminThemeBundle:Breadcrumb:breadcrumb.html.twig', [
'active' => $list,
'title' => $title
));
]);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DefaultController extends Controller
*/
public function indexAction()
{
return array();
return [];
}

/**
Expand All @@ -44,9 +44,9 @@ public function uiIconsAction() {
public function formAction() {
$form = $this->createForm(FormDemoModelType::class);

return $this->render('AvanzuAdminThemeBundle:Default:form.html.twig', array(
return $this->render('AvanzuAdminThemeBundle:Default:form.html.twig', [
'form' => $form->createView()
));
]);
}

public function loginAction() {
Expand Down
16 changes: 8 additions & 8 deletions Controller/NavbarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function notificationsAction($max = 5)

return $this->render(
'AvanzuAdminThemeBundle:Navbar:notifications.html.twig',
array(
[
'notifications' => $listEvent->getNotifications(),
'total' => $listEvent->getTotal()
)
]
);
}

Expand All @@ -57,10 +57,10 @@ public function messagesAction($max = 5)

return $this->render(
'AvanzuAdminThemeBundle:Navbar:messages.html.twig',
array(
[
'messages' => $listEvent->getMessages(),
'total' => $listEvent->getTotal()
)
]
);
}

Expand All @@ -78,10 +78,10 @@ public function tasksAction($max = 5)

return $this->render(
'AvanzuAdminThemeBundle:Navbar:tasks.html.twig',
array(
[
'tasks' => $listEvent->getTasks(),
'total' => $listEvent->getTotal()
)
]
);
}

Expand All @@ -97,9 +97,9 @@ public function userAction()

return $this->render(
'AvanzuAdminThemeBundle:Navbar:user.html.twig',
array(
[
'user' => $userEvent->getUser()
)
]
);
}
}
4 changes: 2 additions & 2 deletions Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function loginAction(Request $request)

return $this->render(
'AvanzuAdminThemeBundle:Security:login.html.twig',
array(
[
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'error' => $error,
)
]
);
}
}
10 changes: 5 additions & 5 deletions Controller/SidebarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public function userPanelAction()

return $this->render(
'AvanzuAdminThemeBundle:Sidebar:user-panel.html.twig',
array(
[
'user' => $userEvent->getUser()
)
]
);
}

Expand All @@ -40,7 +40,7 @@ protected function getDispatcher()

public function searchFormAction()
{
return $this->render('AvanzuAdminThemeBundle:Sidebar:search-form.html.twig', array());
return $this->render('AvanzuAdminThemeBundle:Sidebar:search-form.html.twig', []);
}

public function menuAction(Request $request)
Expand All @@ -53,9 +53,9 @@ public function menuAction(Request $request)

return $this->render(
'AvanzuAdminThemeBundle:Sidebar:menu.html.twig',
array(
[
'menu' => $event->getItems()
)
]
);
}
}
20 changes: 10 additions & 10 deletions DependencyInjection/AvanzuAdminThemeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public function prepend(ContainerBuilder $container)
if (isset($bundles['TwigBundle'])) {
$container->prependExtensionConfig(
'twig',
array(
'form_theme' => array(
[
'form_theme' => [
'AvanzuAdminThemeBundle:layout:form-theme.html.twig'
),
'globals' => array(
],
'globals' => [
'admin_theme' => '@avanzu_admin_theme.theme_manager'
)
)
]
]
);
}

Expand All @@ -60,12 +60,12 @@ public function prepend(ContainerBuilder $container)

$container->prependExtensionConfig(
'assetic',
array(
[
'assets' => $assets,
'bundles' => array(
'bundles' => [
'AvanzuAdminThemeBundle'
)
)
]
]
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/Compiler/TwigPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function process(ContainerBuilder $container)
$param = $container->getParameter('twig.form.resources');

if(! is_array($param)) {
$param = array();
$param = [];
}

array_push($param, 'AvanzuAdminThemeBundle:layout:form-theme.html.twig');
Expand All @@ -44,10 +44,10 @@ public function process(ContainerBuilder $container)

$twigDefinition = $container->getDefinition('twig');

$twigDefinition->addMethodCall('addGlobal', array(
$twigDefinition->addMethodCall('addGlobal', [
'avanzu_admin_context',
new Reference('avanzu_admin_theme.context_helper')
)
]
);
}
}
2 changes: 1 addition & 1 deletion Event/MessageListEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MessageListEvent extends ThemeEvent
*
* @var array
*/
protected $messages = array();
protected $messages = [];

/**
* Stores the total amount
Expand Down
2 changes: 1 addition & 1 deletion Event/NotificationListEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NotificationListEvent extends ThemeEvent
/**
* @var array
*/
protected $notifications = array();
protected $notifications = [];

protected $total = 0;

Expand Down
2 changes: 1 addition & 1 deletion Event/SidebarMenuEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SidebarMenuEvent extends ThemeEvent
/**
* @var array
*/
protected $menuRootItems = array();
protected $menuRootItems = [];

/**
* @var Request
Expand Down
Loading

0 comments on commit f2e2c4c

Please sign in to comment.