Fix more code style issues

This commit is contained in:
Timothy Warren 2017-02-15 11:57:29 -05:00
parent 30b398c946
commit a04643ea10
6 changed files with 24 additions and 26 deletions

View File

@ -74,7 +74,7 @@ class CSSMin extends BaseMin {
//Remove tabs, spaces, newlines, etc.
$buffer = preg_replace('`\s+`', ' ', $buffer);
$replace = array(
$replace = [
' )' => ')',
') ' => ')',
' }' => '}',
@ -84,7 +84,7 @@ class CSSMin extends BaseMin {
', ' => ',',
': ' => ':',
'; ' => ';',
);
];
//Eradicate every last space!
$buffer = trim(strtr($buffer, $replace));
@ -101,7 +101,7 @@ class CSSMin extends BaseMin {
*/
protected function get_last_modified()
{
$modified = array();
$modified = [];
// Get all the css files, and concatenate them together
if(isset($this->group))

View File

@ -168,7 +168,7 @@ class JSMin extends BaseMin {
*/
protected function get_last_modified()
{
$modified = array();
$modified = [];
foreach($this->js_group as $file)
{

View File

@ -24,7 +24,7 @@ use Aviat\Ion\Transformer\AbstractTransformer;
*/
class AnimeListTransformer extends AbstractTransformer {
const statusMap = [
const STATUS_MAP = [
AnimeWatchingStatus::WATCHING => '1',
AnimeWatchingStatus::COMPLETED => '2',
AnimeWatchingStatus::ON_HOLD => '3',
@ -45,7 +45,7 @@ class AnimeListTransformer extends AbstractTransformer {
return [
'id' => $item['mal_id'],
'data' => [
'status' => self::statusMap[$item['watching_status']],
'status' => self::STATUS_MAP[$item['watching_status']],
'rating' => $item['user_rating'],
'rewatch_value' => (int) $rewatching,
'times_rewatched' => $item['rewatched'],
@ -58,7 +58,7 @@ class AnimeListTransformer extends AbstractTransformer {
/**
* Transform Kitsu episode data to MAL episode data
*
* @param array $item
* @param array $item
* @return array
*/
public function untransform(array $item): array
@ -93,7 +93,7 @@ class AnimeListTransformer extends AbstractTransformer {
break;
case 'status':
$map['data']['status'] = self::statusMap[$value];
$map['data']['status'] = self::STATUS_MAP[$value];
break;
default:

View File

@ -15,7 +15,7 @@ class DispatcherTest extends AnimeClient_TestCase {
protected $router;
protected $config;
protected function _set_up($config, $uri, $host)
protected function doSetUp($config, $uri, $host)
{
// Set up the environment
$_SERVER = array_merge($_SERVER, [
@ -49,7 +49,7 @@ class DispatcherTest extends AnimeClient_TestCase {
public function testRouterSanity()
{
$this->_set_up([], '/', 'localhost');
$this->doSetUp([], '/', 'localhost');
$this->assertTrue(is_object($this->router));
}
@ -130,11 +130,9 @@ class DispatcherTest extends AnimeClient_TestCase {
*/
public function testRoute($config, $controller, $host, $uri)
{
$this->_set_up($config, $uri, $host);
$this->doSetUp($config, $uri, $host);
$request = $this->container->get('request');
$aura_router = $this->container->get('aura-router');
// Check route setup
$this->assertEquals($config['routes'], $this->config->get('routes'), "Incorrect route path");
@ -191,7 +189,7 @@ class DispatcherTest extends AnimeClient_TestCase {
]
];
$this->_set_up($config, "/", "localhost");
$this->doSetUp($config, "/", "localhost");
$this->assertEquals('//localhost/manga/all', $this->urlGenerator->default_url('manga'), "Incorrect default url");
$this->assertEquals('//localhost/anime/watching', $this->urlGenerator->default_url('anime'), "Incorrect default url");
@ -252,7 +250,7 @@ class DispatcherTest extends AnimeClient_TestCase {
*/
public function testGetControllerList($config, $expected)
{
$this->_set_up($config, '/', 'localhost');
$this->doSetUp($config, '/', 'localhost');
$this->assertEquals($expected, $this->router->getControllerList());
}
}

View File

@ -16,13 +16,13 @@ class RoutingBaseTest extends AnimeClient_TestCase {
{
return [
'empty_segment' => [
'request_uri' => ' // ',
'requestUri' => ' // ',
'path' => '/',
'segments' => ['', ''],
'last_segment' => NULL
],
'three_segments' => [
'request_uri' => '/anime/watching/list ',
'requestUri' => '/anime/watching/list ',
'path' => '/anime/watching/list',
'segments' => ['', 'anime', 'watching', 'list'],
'last_segment' => 'list'
@ -33,11 +33,11 @@ class RoutingBaseTest extends AnimeClient_TestCase {
/**
* @dataProvider dataSegments
*/
public function testSegments($request_uri, $path, $segments, $last_segment)
public function testSegments($requestUri, $path, $segments, $last_segment)
{
$this->setSuperGlobals([
'_SERVER' => [
'REQUEST_URI' => $request_uri
'REQUEST_URI' => $requestUri
]
]);

View File

@ -5,7 +5,7 @@ namespace Aviat\AnimeClient\Tests;
class TestSessionHandler implements \SessionHandlerInterface {
public $data = [];
public $save_path = './test_data/sessions';
public $savePath = './test_data/sessions';
public function close()
{
@ -14,7 +14,7 @@ class TestSessionHandler implements \SessionHandlerInterface {
public function destroy($id)
{
$file = "$this->save_path/$id";
$file = "$this->savePath/$id";
if (file_exists($file))
{
@unlink($file);
@ -28,11 +28,11 @@ class TestSessionHandler implements \SessionHandlerInterface {
return TRUE;
}
public function open($save_path, $name)
public function open($savePath, $name)
{
/*if ( ! array_key_exists($save_path, $this->data))
/*if ( ! array_key_exists($savePath, $this->data))
{
$this->save_path = $save_path;
$this->savePath = $savePath;
$this->data = [];
}*/
return TRUE;
@ -40,12 +40,12 @@ class TestSessionHandler implements \SessionHandlerInterface {
public function read($id)
{
return json_decode(@file_get_contents("$this->save_path/$id"), TRUE);
return json_decode(@file_get_contents("$this->savePath/$id"), TRUE);
}
public function write($id, $data)
{
$file = "$this->save_path/$id";
$file = "$this->savePath/$id";
file_put_contents($file, json_encode($data));
return TRUE;