Skip to content

Commit

Permalink
Convert to PHP 5.4 array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Apr 16, 2014
1 parent edb9db9 commit 7e1144f
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 127 deletions.
28 changes: 14 additions & 14 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
* and is licensed under the MIT license.
*/

return array(
'service_manager' => array(
'factories' => array(
return [
'service_manager' => [
'factories' => [
'ZfrPrerender\Mvc\PrerenderListener' => 'ZfrPrerender\Factory\PrerenderListenerFactory',
'ZfrPrerender\Options\ModuleOptions' => 'ZfrPrerender\Factory\ModuleOptionsFactory'
)
),
]
],

'zfr_prerender' => array(
'zfr_prerender' => [
// Prerender service URL
'prerender_url' => 'http://prerender.herokuapp.com',

// Some widely used crawler user agents (Google Bot, Yahoo and BingBot are not in this list because
// we support _escaped_fragment_ and want to ensure people aren't penalized for cloaking).
'crawler_user_agents' => array(
'crawler_user_agents' => [
'baiduspider',
'facebookexternalhit',
'twitterbot',
Expand All @@ -41,10 +41,10 @@
'quora link preview',
'showyoubot',
'outbrain'
),
],

// Ignored extensions
'ignored_extensions' => array(
'ignored_extensions' => [
'.js',
'.css',
'.less',
Expand Down Expand Up @@ -81,10 +81,10 @@
'.m4v',
'.torrent',
'.xml'
),
],

// Whitelist and blacklist URLs
'whitelist_urls' => array(),
'blacklist_urls' => array()
)
);
'whitelist_urls' => [],
'blacklist_urls' => []
]
];
4 changes: 2 additions & 2 deletions src/ZfrPrerender/Mvc/PrerenderListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(ModuleOptions $options)
*/
public function attach(EventManagerInterface $events)
{
$this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'prerenderPage'), 1000);
$this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'prerenderPage'], 1000);
}

/**
Expand Down Expand Up @@ -290,7 +290,7 @@ private function decompressResponse(HttpResponse $response)
*/
public function setEventManager(EventManagerInterface $eventManager)
{
$eventManager->setIdentifiers(array(__CLASS__, get_class($this)));
$eventManager->setIdentifiers([__CLASS__, get_class($this)]);
$this->eventManager = $eventManager;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ZfrPrerender/Options/ModuleOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ class ModuleOptions extends AbstractOptions
/**
* @var array
*/
protected $crawlerUserAgents = array();
protected $crawlerUserAgents = [];

/**
* @var array
*/
protected $ignoredExtensions = array();
protected $ignoredExtensions = [];

/**
* @var array
*/
protected $whitelistUrls = array();
protected $whitelistUrls = [];

/**
* @var array
*/
protected $blacklistUrls = array();
protected $blacklistUrls = [];

/**
* Set the prerender service URL
Expand Down
4 changes: 2 additions & 2 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

ini_set('error_reporting', E_ALL);

$files = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php');
$files = [__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'];

foreach ($files as $file) {
if (file_exists($file)) {
Expand All @@ -36,7 +36,7 @@

$loader->add('ZfrPrerenderTest\\', __DIR__);

$configFiles = array(__DIR__ . '/TestConfiguration.php', __DIR__ . '/TestConfiguration.php.dist');
$configFiles = [__DIR__ . '/TestConfiguration.php', __DIR__ . '/TestConfiguration.php.dist'];

foreach ($configFiles as $configFile) {
if (file_exists($configFile)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/ZfrPrerenderTest/Factory/ModuleOptionsFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function testCanCreateOptions()
$serviceManager = ServiceManagerFactory::getServiceManager();
$options = $serviceManager->get('ZfrPrerender\Options\ModuleOptions');

$expectedCrawlerUserAgents = array(
$expectedCrawlerUserAgents = [
'baiduspider', 'facebookexternalhit', 'twitterbot', 'rogerbot', 'linkedinbot',
'embedly', 'bufferbot', 'quora link preview', 'showyoubot', 'outbrain'
);
];

$this->assertInstanceOf('ZfrPrerender\Options\ModuleOptions', $options);
$this->assertEquals('http://prerender.herokuapp.com', $options->getPrerenderUrl());
Expand Down
4 changes: 2 additions & 2 deletions tests/ZfrPrerenderTest/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public function testAssertListenerIsCorrectlyRegistered()
{
$module = new Module();
$mvcEvent = $this->getMock('Zend\Mvc\MvcEvent');
$application = $this->getMock('Zend\Mvc\Application', array(), array(), '', false);
$application = $this->getMock('Zend\Mvc\Application', [], [], '', false);
$eventManager = $this->getMock('Zend\EventManager\EventManagerInterface');
$serviceManager = $this->getMock('Zend\ServiceManager\ServiceManager');
$prerenderListener = $this->getMock('ZfrPrerender\Mvc\PrerenderListener', array(), array(), '', false);
$prerenderListener = $this->getMock('ZfrPrerender\Mvc\PrerenderListener', [], [], '', false);

$mvcEvent->expects($this->any())->method('getTarget')->will($this->returnValue($application));
$application->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
Expand Down
Loading

0 comments on commit 7e1144f

Please sign in to comment.