Skip to content

Commit

Permalink
Merge pull request #54 from samsonasik/1.0.0
Browse files Browse the repository at this point in the history
preparation for 1.0.0
  • Loading branch information
samsonasik authored Jul 16, 2016
2 parents fbd122f + 408b1c1 commit 872d2bd
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 141 deletions.
2 changes: 0 additions & 2 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ preset: recommended
linting: true

enabled:
- long_array_syntax
- strict
- unalign_double_arrow

disabled:
- align_double_arrow
- short_array_syntax

finder:
exclude:
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ sudo: false
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7
- hhvm
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 1.0.0 - 2016-07-16

- support only php ^5.6 | ^7.0
- bring short array syntax
- support only zf ^2.5 components

### 0.6.3 - 2016-06-28

- zdt dependency in require-dev
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Installation
Installation of this module uses composer.

```sh
$ composer require san/san-session-toolbar 0.*
$ composer require san/san-session-toolbar
```

For composer documentation, please refer to [getcomposer.org](https://getcomposer.org/).
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
}
],
"require": {
"php": ">=5.3.23,<8",
"zendframework/zend-session": "~2.3",
"zendframework/zend-debug": "~2.3",
"zendframework/zend-json": "~2.3 || ~3.0"
"php": "^5.6 || ^7.0",
"zendframework/zend-session": "^2.5",
"zendframework/zend-debug": "^2.5",
"zendframework/zend-json": "^2.5 || ^3.0"
},
"require-dev": {
"container-interop/container-interop": "^1.1",
"satooshi/php-coveralls": "^1.0",
"phpunit/phpcov": "~2.0",
"zendframework/zend-test": "~2.3",
"zendframework/zend-serializer": "~2.3",
"zendframework/zend-log": "~2.3",
"zendframework/zend-i18n": "~2.3",
"zendframework/zend-view": "~2.3",
"zendframework/zend-test": "^2.5",
"zendframework/zend-serializer": "^2.5",
"zendframework/zend-log": "^2.5",
"zendframework/zend-i18n": "^2.5",
"zendframework/zend-view": "^2.5",
"zendframework/zend-developer-tools": "^1.0.0 || ^1.1.0"
},
"suggest": {
Expand Down
80 changes: 40 additions & 40 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,62 +17,62 @@
* and is licensed under the MIT license.
*/

return array(
return [

'controllers' => array(
'factories' => array(
'controllers' => [
'factories' => [
'SanSessionToolbar\Controller\SessionToolbar' => 'SanSessionToolbar\Factory\Controller\SessionToolbarControllerFactory',
),
),
],
],

'router' => array(
'routes' => array(
'san-session-toolbar' => array(
'router' => [
'routes' => [
'san-session-toolbar' => [
'type' => 'segment',
'options' => array(
'options' => [
'route' => '/san-session-toolbar[/:action]',
'constraints' => array(
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
],
'defaults' => [
'controller' => 'SanSessionToolbar\Controller\SessionToolbar',
'action' => 'removesession',
),
),
),
),
),
],
],
],
],
],

'service_manager' => array(
'invokables' => array(
'service_manager' => [
'invokables' => [
'SanSessionManager' => 'SanSessionToolbar\Manager\SessionManager',
),
'factories' => array(
],
'factories' => [
'session.toolbar' => 'SanSessionToolbar\Factory\Collector\SessionCollectorFactory',
),
),
],
],

'view_manager' => array(
'template_map' => array(
'view_manager' => [
'template_map' => [
'zend-developer-tools/toolbar/session-data' => __DIR__.'/../view/zend-developer-tools/toolbar/session-data.phtml',
'zend-developer-tools/toolbar/session-data-list' => __DIR__.'/../view/zend-developer-tools/toolbar/session-data-list.phtml',
),
'strategies' => array(
],
'strategies' => [
'ViewJsonStrategy',
),
),
],
],

'zenddevelopertools' => array(
'profiler' => array(
'collectors' => array(
'zenddevelopertools' => [
'profiler' => [
'collectors' => [
'session.toolbar' => 'session.toolbar',
),
),
'toolbar' => array(
'entries' => array(
],
],
'toolbar' => [
'entries' => [
'session.toolbar' => 'zend-developer-tools/toolbar/session-data',
),
),
),
],
],
],

);
];
2 changes: 1 addition & 1 deletion src/Collector/SessionCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getPriority()
public function collect(MvcEvent $mvcEvent)
{
if (!isset($this->data['san-session'])) {
$this->data['san-session'] = array();
$this->data['san-session'] = [];
}
}

Expand Down
30 changes: 15 additions & 15 deletions src/Controller/SessionToolbarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public function removesessionAction()
->sessionSetting($containerName, $keysession);
}

return new JsonModel(array(
return new JsonModel([
'success' => $success,
));
]);
}

/**
Expand All @@ -82,11 +82,11 @@ public function reloadsessionAction()
$sessionData = $this->sessionManager->getSessionData(false);

$renderedContent = $this->viewRenderer
->render('zend-developer-tools/toolbar/session-data-list', array('sessionData' => $sessionData));
->render('zend-developer-tools/toolbar/session-data-list', ['sessionData' => $sessionData]);

return new JsonModel(array(
return new JsonModel([
'san_sessiontoolbar_data_renderedContent' => $renderedContent,
));
]);
}

/**
Expand All @@ -101,19 +101,19 @@ public function clearsessionAction()

$sessionData = $this->sessionManager->getSessionData();
$renderedContent = $this->viewRenderer
->render('zend-developer-tools/toolbar/session-data-list', array('sessionData' => $sessionData));
->render('zend-developer-tools/toolbar/session-data-list', ['sessionData' => $sessionData]);

return new JsonModel(array(
return new JsonModel([
'san_sessiontoolbar_data_renderedContent' => $renderedContent,
));
]);
}

/**
* Save Session by Container and its key.
*/
public function savesessionAction()
{
$processSetOrAddSessionData = array('success' => false, 'errorMessage' => '');
$processSetOrAddSessionData = ['success' => false, 'errorMessage' => ''];
$request = $this->getEvent()->getRequest();

if ($request instanceof Request && $request->isPost()) {
Expand All @@ -122,13 +122,13 @@ public function savesessionAction()

$sessionData = $this->sessionManager->getSessionData();
$renderedContent = $this->viewRenderer
->render('zend-developer-tools/toolbar/session-data-list', array('sessionData' => $sessionData));
->render('zend-developer-tools/toolbar/session-data-list', ['sessionData' => $sessionData]);

return new JsonModel(array(
return new JsonModel([
'success' => $processSetOrAddSessionData['success'],
'errorMessage' => $processSetOrAddSessionData['errorMessage'],
'san_sessiontoolbar_data_renderedContent' => $renderedContent,
));
]);
}

/**
Expand All @@ -148,11 +148,11 @@ private function setOrAddSession(Request $request)
$notEmptyValidator = new NotEmpty();
if ($notEmptyValidator->isValid($keysession) && $notEmptyValidator->isValid($sessionValue)) {
$success = $this->sessionManager
->sessionSetting($containerName, $keysession, $sessionValue, array('set' => true, 'new' => $new));
->sessionSetting($containerName, $keysession, $sessionValue, ['set' => true, 'new' => $new]);

return array('success' => $success, 'errorMessage' => '');
return ['success' => $success, 'errorMessage' => ''];
}

return array('success' => false, 'errorMessage' => 'Value is required and can\'t be empty');
return ['success' => false, 'errorMessage' => 'Value is required and can\'t be empty'];
}
}
4 changes: 2 additions & 2 deletions src/Manager/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getSessionData($checkExists = true)
*/
private function collectSessionData(array $arraysession)
{
$data = array();
$data = [];

foreach ($arraysession as $key => $row) {
if ($row instanceof ArrayObject) {
Expand All @@ -71,7 +71,7 @@ private function collectSessionData(array $arraysession)
/**
* {@inheritdoc}
*/
public function sessionSetting($containerName, $keysession, $value = null, $options = array())
public function sessionSetting($containerName, $keysession, $value = null, $options = [])
{
$container = new Container($containerName);
$set = (!empty($options['set'])) ? $options['set'] : false;
Expand Down
2 changes: 1 addition & 1 deletion src/Manager/SessionManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getSessionData($checkExists = true);
*
* @return bool
*/
public function sessionSetting($containerName, $keysession, $value = null, $options = array());
public function sessionSetting($containerName, $keysession, $value = null, $options = []);

/**
* Clear Session.
Expand Down
6 changes: 3 additions & 3 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function onBootstrap(MvcEvent $e)
$sharedEvm->attach(
'Zend\Mvc\Controller\AbstractActionController',
'dispatch',
array($this, 'flashMessengerHandler'),
[$this, 'flashMessengerHandler'],
2
);
}
Expand All @@ -67,7 +67,7 @@ public function flashMessengerHandler(EventInterface $e)
foreach ($reCreateFlash as $key => $row) {
if ($row instanceof SplQueue) {
$flashPerNameSpace = $flash->setNamespace($key);
$valuesMessage = array();
$valuesMessage = [];
foreach ($row->toArray() as $keyArray => $rowArray) {
$flashPerNameSpace->addMessage($rowArray);
$valuesMessage[] = $rowArray;
Expand All @@ -90,6 +90,6 @@ public function getConfig()
*/
public function getModuleDependencies()
{
return array('ZendDeveloperTools');
return ['ZendDeveloperTools'];
}
}
34 changes: 17 additions & 17 deletions test/Collector/SessionCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,32 @@ public function testCallCollect()
public function testGetSessionData()
{
$this->sessionContainer->word = 'zaf8go6i';
$this->sessionContainer->a = array(
$this->sessionContainer->a = [
'foo' => 'bar',
42 => 24,
'multi' => array(
'dimensional' => array(
'multi' => [
'dimensional' => [
'array' => 'foo',
),
),
);
],
],
];
$this->sessionContainer->bar = 'bar';

$this->assertEquals(array(
'Default' => array(
$this->assertEquals([
'Default' => [
'word' => 'zaf8go6i',
'a' => array(
'a' => [
'foo' => 'bar',
42 => 24,
'multi' => array(
'dimensional' => array(
'multi' => [
'dimensional' => [
'array' => 'foo',
),
),
),
],
],
],
'bar' => 'bar',
),
), $this->sessionCollector->getSessionData());
],
], $this->sessionCollector->getSessionData());
}

/**
Expand All @@ -129,7 +129,7 @@ public function testGetSessionDataForEmpty()
$this->sessionContainer->offsetUnset('bar');

$this->sessionCollector->collect(new MvcEvent());
$this->assertEquals(array(), $this->sessionCollector->getSessionData());
$this->assertEquals([], $this->sessionCollector->getSessionData());
}

protected function tearDown()
Expand Down
Loading

0 comments on commit 872d2bd

Please sign in to comment.