Skip to content

Commit

Permalink
PHPCS Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chadicus committed Apr 26, 2017
1 parent ab8bacf commit 5f0fd49
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 118 deletions.
46 changes: 24 additions & 22 deletions tests/Assets/ArrayCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ArrayCache implements CacheInterface
*
* @return mixed The value of the item from the cache, or $default in case of cache miss.
*/
public function get($key, $default = null)
public function get($key, $default = null)//@codingStandardsIgnoreLine Interface does not define type-hints
{
$cache = Arrays::get($this->cache, $key);
if ($cache === null) {
Expand All @@ -43,15 +43,15 @@ public function get($key, $default = null)
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store, must be serializable.
* @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store, must be serializable.
* @param null|integer|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
* @return boolean True on success and false on failure.
*/
public function set($key, $value, $ttl = null)
public function set($key, $value, $ttl = null)//@codingStandardsIgnoreLine Interface does not define type-hints
{
$this->cache[$key] = [
'response' => $value,
Expand All @@ -66,9 +66,9 @@ public function set($key, $value, $ttl = null)
*
* @param string $key The unique cache key of the item to delete.
*
* @return bool True if the item was successfully removed. False if there was an error.
* @return boolean True if the item was successfully removed. False if there was an error.
*/
public function delete($key)
public function delete($key)//@codingStandardsIgnoreLine Interface does not define type-hints
{
unset($this->cache[$key]);
return true;
Expand All @@ -77,7 +77,7 @@ public function delete($key)
/**
* Wipes clean the entire cache's keys.
*
* @return bool True on success and false on failure.
* @return boolean True on success and false on failure.
*/
public function clear()
{
Expand All @@ -93,7 +93,7 @@ public function clear()
*
* @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
*/
public function getMultiple($keys, $default = null)
public function getMultiple($keys, $default = null)//@codingStandardsIgnoreLine Interface does not define type-hints
{
$items = [];
foreach ($keys as $key) {
Expand All @@ -106,14 +106,14 @@ public function getMultiple($keys, $default = null)
/**
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param null|integer|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
* @return boolean True on success and false on failure.
*/
public function setMultiple($values, $ttl = null)
public function setMultiple($values, $ttl = null)//@codingStandardsIgnoreLine Interface does not define type-hints
{
foreach ($values as $key => $value) {
$this->set($key, $value, $ttl);
Expand All @@ -127,9 +127,9 @@ public function setMultiple($values, $ttl = null)
*
* @param iterable $keys A list of string-based keys to be deleted.
*
* @return bool True if the items were successfully removed. False if there was an error.
* @return boolean True if the items were successfully removed. False if there was an error.
*/
public function deleteMultiple($keys)
public function deleteMultiple($keys)//@codingStandardsIgnoreLine Interface does not define type-hints
{
foreach ($keys as $key) {
$this->delete($key);
Expand All @@ -148,9 +148,9 @@ public function deleteMultiple($keys)
*
* @param string $key The cache item key.
*
* @return bool
* @return boolean
*/
public function has($key)
public function has($key)//@codingStandardsIgnoreLine Interface does not define type-hints
{
return isset($this->cache[$key]);
}
Expand All @@ -161,6 +161,8 @@ public function has($key)
* @param mixed $ttl The time-to-live value to validate.
*
* @return integer
*
* @throws \InvalidArgumentException if $ttl is not an integer or DateInterval
*/
private function getExpires($ttl)
{
Expand Down
120 changes: 24 additions & 96 deletions tests/Entities/ComicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,124 +574,52 @@ private static function getTestData()
'issn' => 'an issn',
'format' => 'a format',
'pageCount' => 4,
'textObjects' => [
[
'type' => 'a text object type',
'language' => 'a language',
'text' => 'a text',
],
],
'textObjects' => [['type' => 'a text object type', 'language' => 'a language', 'text' => 'a text']],
'resourceURI' => 'a resource URI',
'urls' => [
[
'type' => 'a url type',
'url' => 'a url',
],
],
'series' => [
'resourceURI' => 'a series resource URI',
'name' => 'a series name',
'type' => 'a series type',
'role' => 'a series role',
],
'urls' => [['type' => 'a url type', 'url' => 'a url']],
'series' => self::getResourceArray('series'),
'events' => [
'available' => 1,
'returned' => 1,
'collectionURI' => 'an events collection uri',
'items' => [
[
'resourceURI' => 'a event resource URI',
'name' => 'a event name',
'type' => 'a event type',
'role' => 'a event role',
]
],
'items' => [self::getResourceArray('event')],
],
'stories' => [
'available' => 1,
'returned' => 1,
'collectionURI' => 'an stories collection uri',
'items' => [
[
'resourceURI' => 'a story resource URI',
'name' => 'a story name',
'type' => 'a story type',
'role' => 'a story role',
]
],
'items' => [self::getResourceArray('story')],
],
'creators' => [
'available' => 1,
'returned' => 1,
'collectionURI' => 'an creators collection uri',
'items' => [
[
'resourceURI' => 'a creator resource URI',
'name' => 'a creator name',
'type' => 'a creator type',
'role' => 'a creator role',
]
],
'items' => [self::getResourceArray('creator')],
],
'characters' => [
'available' => 1,
'returned' => 1,
'collectionURI' => 'an characters collection uri',
'items' => [
[
'resourceURI' => 'a character resource URI',
'name' => 'a character name',
'type' => 'a character type',
'role' => 'a character role',
]
],
],
'variants' => [
[
'resourceURI' => 'a variant resource URI',
'name' => 'a variant name',
'type' => 'a variant type',
'role' => 'a variant role',
],
],
'collections' => [
[
'resourceURI' => 'a collection resource URI',
'name' => 'a collection name',
'type' => 'a collection type',
'role' => 'a collection role',
],
],
'collectedIssues' => [
[
'resourceURI' => 'a collected issues resource URI',
'name' => 'a collected issues name',
'type' => 'a collected issues type',
'role' => 'a collected issues role',
],
],
'dates' => [
[
'type' => 'a date type',
'date' => 'Fri, 31 Jul 2015 08:53:11 -0400',
],
'items' => [self::getResourceArray('character')],
],
'prices' => [
[
'type' => 'a price type',
'price' => 1.1,
],
],
'thumbnail' => [
'path' => 'a thumbnail path',
'extension' => 'a thumbnail extension',
],
'images' => [
[
'path' => 'an image path',
'extension' => 'an image extension',
],
'variants' => [self::getResourceArray('variant')],
'collections' => [self::getResourceArray('collection resource')],
'collectedIssues' => [self::getResourceArray('collected issues')],
'dates' => [['type' => 'a date type', 'date' => 'Fri, 31 Jul 2015 08:53:11 -0400']],
'prices' => [['type' => 'a price type', 'price' => 1.1]],
'thumbnail' => ['path' => 'a thumbnail path', 'extension' => 'a thumbnail extension'],
'images' => [['path' => 'an image path', 'extension' => 'an image extension'],
],
];
}

private static function getResourceArray(string $resource)
{
return [
'resourceURI' => "a {$resource} resource URI",
'name' => "a {$resource} name",
'type' => "a {$resource} type",
'role' => "a {$resource} role",
];
}
}

0 comments on commit 5f0fd49

Please sign in to comment.