Fix more code style issues
This commit is contained in:
parent
36874cbe55
commit
0a72e60f68
@ -74,7 +74,7 @@ class CSSMin extends BaseMin {
|
|||||||
|
|
||||||
//Remove tabs, spaces, newlines, etc.
|
//Remove tabs, spaces, newlines, etc.
|
||||||
$buffer = preg_replace('`\s+`', ' ', $buffer);
|
$buffer = preg_replace('`\s+`', ' ', $buffer);
|
||||||
$replace = array(
|
$replace = [
|
||||||
' )' => ')',
|
' )' => ')',
|
||||||
') ' => ')',
|
') ' => ')',
|
||||||
' }' => '}',
|
' }' => '}',
|
||||||
@ -84,7 +84,7 @@ class CSSMin extends BaseMin {
|
|||||||
', ' => ',',
|
', ' => ',',
|
||||||
': ' => ':',
|
': ' => ':',
|
||||||
'; ' => ';',
|
'; ' => ';',
|
||||||
);
|
];
|
||||||
|
|
||||||
//Eradicate every last space!
|
//Eradicate every last space!
|
||||||
$buffer = trim(strtr($buffer, $replace));
|
$buffer = trim(strtr($buffer, $replace));
|
||||||
@ -101,7 +101,7 @@ class CSSMin extends BaseMin {
|
|||||||
*/
|
*/
|
||||||
protected function get_last_modified()
|
protected function get_last_modified()
|
||||||
{
|
{
|
||||||
$modified = array();
|
$modified = [];
|
||||||
|
|
||||||
// Get all the css files, and concatenate them together
|
// Get all the css files, and concatenate them together
|
||||||
if(isset($this->group))
|
if(isset($this->group))
|
||||||
|
@ -168,7 +168,7 @@ class JSMin extends BaseMin {
|
|||||||
*/
|
*/
|
||||||
protected function get_last_modified()
|
protected function get_last_modified()
|
||||||
{
|
{
|
||||||
$modified = array();
|
$modified = [];
|
||||||
|
|
||||||
foreach($this->js_group as $file)
|
foreach($this->js_group as $file)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ use Aviat\Ion\Transformer\AbstractTransformer;
|
|||||||
*/
|
*/
|
||||||
class AnimeListTransformer extends AbstractTransformer {
|
class AnimeListTransformer extends AbstractTransformer {
|
||||||
|
|
||||||
const statusMap = [
|
const STATUS_MAP = [
|
||||||
AnimeWatchingStatus::WATCHING => '1',
|
AnimeWatchingStatus::WATCHING => '1',
|
||||||
AnimeWatchingStatus::COMPLETED => '2',
|
AnimeWatchingStatus::COMPLETED => '2',
|
||||||
AnimeWatchingStatus::ON_HOLD => '3',
|
AnimeWatchingStatus::ON_HOLD => '3',
|
||||||
@ -45,7 +45,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
return [
|
return [
|
||||||
'id' => $item['mal_id'],
|
'id' => $item['mal_id'],
|
||||||
'data' => [
|
'data' => [
|
||||||
'status' => self::statusMap[$item['watching_status']],
|
'status' => self::STATUS_MAP[$item['watching_status']],
|
||||||
'rating' => $item['user_rating'],
|
'rating' => $item['user_rating'],
|
||||||
'rewatch_value' => (int) $rewatching,
|
'rewatch_value' => (int) $rewatching,
|
||||||
'times_rewatched' => $item['rewatched'],
|
'times_rewatched' => $item['rewatched'],
|
||||||
@ -58,7 +58,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
/**
|
/**
|
||||||
* Transform Kitsu episode data to MAL episode data
|
* Transform Kitsu episode data to MAL episode data
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function untransform(array $item): array
|
public function untransform(array $item): array
|
||||||
@ -93,7 +93,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'status':
|
case 'status':
|
||||||
$map['data']['status'] = self::statusMap[$value];
|
$map['data']['status'] = self::STATUS_MAP[$value];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -15,7 +15,7 @@ class DispatcherTest extends AnimeClient_TestCase {
|
|||||||
protected $router;
|
protected $router;
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
protected function _set_up($config, $uri, $host)
|
protected function doSetUp($config, $uri, $host)
|
||||||
{
|
{
|
||||||
// Set up the environment
|
// Set up the environment
|
||||||
$_SERVER = array_merge($_SERVER, [
|
$_SERVER = array_merge($_SERVER, [
|
||||||
@ -49,7 +49,7 @@ class DispatcherTest extends AnimeClient_TestCase {
|
|||||||
|
|
||||||
public function testRouterSanity()
|
public function testRouterSanity()
|
||||||
{
|
{
|
||||||
$this->_set_up([], '/', 'localhost');
|
$this->doSetUp([], '/', 'localhost');
|
||||||
$this->assertTrue(is_object($this->router));
|
$this->assertTrue(is_object($this->router));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,11 +130,9 @@ class DispatcherTest extends AnimeClient_TestCase {
|
|||||||
*/
|
*/
|
||||||
public function testRoute($config, $controller, $host, $uri)
|
public function testRoute($config, $controller, $host, $uri)
|
||||||
{
|
{
|
||||||
$this->_set_up($config, $uri, $host);
|
$this->doSetUp($config, $uri, $host);
|
||||||
|
|
||||||
$request = $this->container->get('request');
|
$request = $this->container->get('request');
|
||||||
$aura_router = $this->container->get('aura-router');
|
|
||||||
|
|
||||||
|
|
||||||
// Check route setup
|
// Check route setup
|
||||||
$this->assertEquals($config['routes'], $this->config->get('routes'), "Incorrect route path");
|
$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/manga/all', $this->urlGenerator->default_url('manga'), "Incorrect default url");
|
||||||
$this->assertEquals('//localhost/anime/watching', $this->urlGenerator->default_url('anime'), "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)
|
public function testGetControllerList($config, $expected)
|
||||||
{
|
{
|
||||||
$this->_set_up($config, '/', 'localhost');
|
$this->doSetUp($config, '/', 'localhost');
|
||||||
$this->assertEquals($expected, $this->router->getControllerList());
|
$this->assertEquals($expected, $this->router->getControllerList());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,13 +16,13 @@ class RoutingBaseTest extends AnimeClient_TestCase {
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'empty_segment' => [
|
'empty_segment' => [
|
||||||
'request_uri' => ' // ',
|
'requestUri' => ' // ',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'segments' => ['', ''],
|
'segments' => ['', ''],
|
||||||
'last_segment' => NULL
|
'last_segment' => NULL
|
||||||
],
|
],
|
||||||
'three_segments' => [
|
'three_segments' => [
|
||||||
'request_uri' => '/anime/watching/list ',
|
'requestUri' => '/anime/watching/list ',
|
||||||
'path' => '/anime/watching/list',
|
'path' => '/anime/watching/list',
|
||||||
'segments' => ['', 'anime', 'watching', 'list'],
|
'segments' => ['', 'anime', 'watching', 'list'],
|
||||||
'last_segment' => 'list'
|
'last_segment' => 'list'
|
||||||
@ -33,11 +33,11 @@ class RoutingBaseTest extends AnimeClient_TestCase {
|
|||||||
/**
|
/**
|
||||||
* @dataProvider dataSegments
|
* @dataProvider dataSegments
|
||||||
*/
|
*/
|
||||||
public function testSegments($request_uri, $path, $segments, $last_segment)
|
public function testSegments($requestUri, $path, $segments, $last_segment)
|
||||||
{
|
{
|
||||||
$this->setSuperGlobals([
|
$this->setSuperGlobals([
|
||||||
'_SERVER' => [
|
'_SERVER' => [
|
||||||
'REQUEST_URI' => $request_uri
|
'REQUEST_URI' => $requestUri
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ namespace Aviat\AnimeClient\Tests;
|
|||||||
class TestSessionHandler implements \SessionHandlerInterface {
|
class TestSessionHandler implements \SessionHandlerInterface {
|
||||||
|
|
||||||
public $data = [];
|
public $data = [];
|
||||||
public $save_path = './test_data/sessions';
|
public $savePath = './test_data/sessions';
|
||||||
|
|
||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
@ -14,7 +14,7 @@ class TestSessionHandler implements \SessionHandlerInterface {
|
|||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$file = "$this->save_path/$id";
|
$file = "$this->savePath/$id";
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
@ -28,11 +28,11 @@ class TestSessionHandler implements \SessionHandlerInterface {
|
|||||||
return TRUE;
|
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 = [];
|
$this->data = [];
|
||||||
}*/
|
}*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -40,12 +40,12 @@ class TestSessionHandler implements \SessionHandlerInterface {
|
|||||||
|
|
||||||
public function read($id)
|
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)
|
public function write($id, $data)
|
||||||
{
|
{
|
||||||
$file = "$this->save_path/$id";
|
$file = "$this->savePath/$id";
|
||||||
file_put_contents($file, json_encode($data));
|
file_put_contents($file, json_encode($data));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user