Skip to content

Commit

Permalink
Additional cs fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Graham Campbell <graham@cachethq.io>
  • Loading branch information
Graham Campbell committed Jun 1, 2015
1 parent e626f51 commit abc8d75
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 44 deletions.
4 changes: 3 additions & 1 deletion CacheBasedSessionHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use Illuminate\Contracts\Cache\Repository as CacheContract;
Expand Down
6 changes: 4 additions & 2 deletions CommandsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use Illuminate\Support\ServiceProvider;
use Illuminate\Session\Console\SessionTableCommand;
Expand Down Expand Up @@ -33,6 +35,6 @@ public function register()
*/
public function provides()
{
return array('command.session.database');
return ['command.session.database'];
}
}
4 changes: 3 additions & 1 deletion Console/SessionTableCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session\Console;
<?php

namespace Illuminate\Session\Console;

use Illuminate\Console\Command;
use Illuminate\Foundation\Composer;
Expand Down
4 changes: 3 additions & 1 deletion CookieSessionHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
4 changes: 3 additions & 1 deletion DatabaseSessionHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use Illuminate\Database\ConnectionInterface;
Expand Down
4 changes: 3 additions & 1 deletion EncryptedStore.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use Illuminate\Contracts\Encryption\DecryptException;
Expand Down
4 changes: 3 additions & 1 deletion ExistenceAwareInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

interface ExistenceAwareInterface
{
Expand Down
4 changes: 3 additions & 1 deletion FileSessionHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use Symfony\Component\Finder\Finder;
Expand Down
14 changes: 8 additions & 6 deletions Middleware/StartSession.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session\Middleware;
<?php

namespace Illuminate\Session\Middleware;

use Closure;
use Carbon\Carbon;
Expand Down Expand Up @@ -82,7 +84,7 @@ public function handle($request, Closure $next)
*/
public function terminate($request, $response)
{
if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) {
if ($this->sessionHandled && $this->sessionConfigured() && !$this->usingCookieSessions()) {
$this->manager->driver()->save();
}
}
Expand Down Expand Up @@ -126,7 +128,7 @@ public function getSession(Request $request)
*/
protected function storeCurrentUrl(Request $request, $session)
{
if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) {
if ($request->method() === 'GET' && $request->route() && !$request->ajax()) {
$session->setPreviousUrl($request->fullUrl());
}
}
Expand Down Expand Up @@ -210,7 +212,7 @@ protected function getCookieExpirationDate()
*/
protected function sessionConfigured()
{
return ! is_null(array_get($this->manager->getSessionConfig(), 'driver'));
return !is_null(array_get($this->manager->getSessionConfig(), 'driver'));
}

/**
Expand All @@ -223,7 +225,7 @@ protected function sessionIsPersistent(array $config = null)
{
$config = $config ?: $this->manager->getSessionConfig();

return ! in_array($config['driver'], array(null, 'array'));
return !in_array($config['driver'], [null, 'array']);
}

/**
Expand All @@ -233,7 +235,7 @@ protected function sessionIsPersistent(array $config = null)
*/
protected function usingCookieSessions()
{
if (! $this->sessionConfigured()) {
if (!$this->sessionConfigured()) {
return false;
}

Expand Down
4 changes: 3 additions & 1 deletion SessionInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface as BaseSessionInterface;
Expand Down
4 changes: 3 additions & 1 deletion SessionManager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use Illuminate\Support\Manager;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
Expand Down
4 changes: 3 additions & 1 deletion SessionServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use Illuminate\Support\ServiceProvider;

Expand Down
52 changes: 27 additions & 25 deletions Store.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use SessionHandlerInterface;
use InvalidArgumentException;
Expand Down Expand Up @@ -27,14 +29,14 @@ class Store implements SessionInterface
*
* @var array
*/
protected $attributes = array();
protected $attributes = [];

/**
* The session bags.
*
* @var array
*/
protected $bags = array();
protected $bags = [];

/**
* The meta-data bag instance.
Expand All @@ -48,7 +50,7 @@ class Store implements SessionInterface
*
* @var array
*/
protected $bagData = array();
protected $bagData = [];

/**
* The session handler implementation.
Expand Down Expand Up @@ -87,7 +89,7 @@ public function start()
{
$this->loadSession();

if (! $this->has('_token')) {
if (!$this->has('_token')) {
$this->regenerateToken();
}

Expand All @@ -103,7 +105,7 @@ protected function loadSession()
{
$this->attributes = array_merge($this->attributes, $this->readFromHandler());

foreach (array_merge($this->bags, array($this->metaBag)) as $bag) {
foreach (array_merge($this->bags, [$this->metaBag]) as $bag) {
$this->initializeLocalBag($bag);

$bag->initialize($this->bagData[$bag->getStorageKey()]);
Expand Down Expand Up @@ -165,7 +167,7 @@ public function getId()
*/
public function setId($id)
{
if (! $this->isValidId($id)) {
if (!$this->isValidId($id)) {
$id = $this->generateSessionId();
}

Expand Down Expand Up @@ -278,7 +280,7 @@ protected function prepareForStorage($data)
*/
protected function addBagDataToSession()
{
foreach (array_merge($this->bags, array($this->metaBag)) as $bag) {
foreach (array_merge($this->bags, [$this->metaBag]) as $bag) {
$this->put($bag->getStorageKey(), $this->bagData[$bag->getStorageKey()]);
}
}
Expand All @@ -290,21 +292,21 @@ protected function addBagDataToSession()
*/
public function ageFlashData()
{
foreach ($this->get('flash.old', array()) as $old) {
foreach ($this->get('flash.old', []) as $old) {
$this->forget($old);
}

$this->put('flash.old', $this->get('flash.new', array()));
$this->put('flash.old', $this->get('flash.new', []));

$this->put('flash.new', array());
$this->put('flash.new', []);
}

/**
* {@inheritdoc}
*/
public function has($name)
{
return ! is_null($this->get($name));
return !is_null($this->get($name));
}

/**
Expand Down Expand Up @@ -337,7 +339,7 @@ public function hasOldInput($key = null)
{
$old = $this->getOldInput($key);

return is_null($key) ? count($old) > 0 : ! is_null($old);
return is_null($key) ? count($old) > 0 : !is_null($old);
}

/**
Expand All @@ -349,7 +351,7 @@ public function hasOldInput($key = null)
*/
public function getOldInput($key = null, $default = null)
{
$input = $this->get('_old_input', array());
$input = $this->get('_old_input', []);

// Input that is flashed to the session can be easily retrieved by the
// developer, making repopulating old forms and the like much more
Expand All @@ -374,8 +376,8 @@ public function set($name, $value)
*/
public function put($key, $value = null)
{
if (! is_array($key)) {
$key = array($key => $value);
if (!is_array($key)) {
$key = [$key => $value];
}

foreach ($key as $arrayKey => $arrayValue) {
Expand All @@ -392,7 +394,7 @@ public function put($key, $value = null)
*/
public function push($key, $value)
{
$array = $this->get($key, array());
$array = $this->get($key, []);

$array[] = $value;

Expand All @@ -412,7 +414,7 @@ public function flash($key, $value)

$this->push('flash.new', $key);

$this->removeFromOldFlashData(array($key));
$this->removeFromOldFlashData([$key]);
}

/**
Expand All @@ -433,9 +435,9 @@ public function flashInput(array $value)
*/
public function reflash()
{
$this->mergeNewFlashes($this->get('flash.old', array()));
$this->mergeNewFlashes($this->get('flash.old', []));

$this->put('flash.old', array());
$this->put('flash.old', []);
}

/**
Expand All @@ -461,7 +463,7 @@ public function keep($keys = null)
*/
protected function mergeNewFlashes(array $keys)
{
$values = array_unique(array_merge($this->get('flash.new', array()), $keys));
$values = array_unique(array_merge($this->get('flash.new', []), $keys));

$this->put('flash.new', $values);
}
Expand All @@ -474,7 +476,7 @@ protected function mergeNewFlashes(array $keys)
*/
protected function removeFromOldFlashData(array $keys)
{
$this->put('flash.old', array_diff($this->get('flash.old', array()), $keys));
$this->put('flash.old', array_diff($this->get('flash.old', []), $keys));
}

/**
Expand Down Expand Up @@ -517,7 +519,7 @@ public function forget($key)
*/
public function clear()
{
$this->attributes = array();
$this->attributes = [];

foreach ($this->bags as $bag) {
$bag->clear();
Expand Down Expand Up @@ -556,7 +558,7 @@ public function registerBag(SessionBagInterface $bag)
public function getBag($name)
{
return array_get($this->bags, $name, function () {
throw new InvalidArgumentException("Bag not registered.");
throw new InvalidArgumentException('Bag not registered.');
});
}

Expand All @@ -576,7 +578,7 @@ public function getMetadataBag()
*/
public function getBagData($name)
{
return array_get($this->bagData, $name, array());
return array_get($this->bagData, $name, []);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion TokenMismatchException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Illuminate\Session;
<?php

namespace Illuminate\Session;

use Exception;

Expand Down

0 comments on commit abc8d75

Please sign in to comment.