Version 5.1 - All the GraphQL #32
@ -52,7 +52,7 @@ final class Auth
|
|||||||
->getSegment(SESSION_SEGMENT);
|
->getSegment(SESSION_SEGMENT);
|
||||||
$this->model = $container->get('kitsu-model');
|
$this->model = $container->get('kitsu-model');
|
||||||
|
|
||||||
Event::on('::unauthorized::', [$this, 'reAuthenticate']);
|
Event::on('::unauthorized::', $this->reAuthenticate(...));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -567,7 +567,7 @@ final class Model
|
|||||||
// this way is much faster...
|
// this way is much faster...
|
||||||
foreach ($statuses as $status)
|
foreach ($statuses as $status)
|
||||||
{
|
{
|
||||||
foreach ($this->getPages([$this, 'getThumbListPages'], strtoupper($type), $status) as $page)
|
foreach ($this->getPages($this->getThumbListPages(...), strtoupper($type), $status) as $page)
|
||||||
{
|
{
|
||||||
$pages[] = $page;
|
$pages[] = $page;
|
||||||
}
|
}
|
||||||
@ -597,7 +597,7 @@ final class Model
|
|||||||
// this way is much faster...
|
// this way is much faster...
|
||||||
foreach ($statuses as $status)
|
foreach ($statuses as $status)
|
||||||
{
|
{
|
||||||
foreach ($this->getPages([$this, 'getSyncPages'], strtoupper($type), $status) as $page)
|
foreach ($this->getPages($this->getSyncPages(...), strtoupper($type), $status) as $page)
|
||||||
{
|
{
|
||||||
$pages[] = $page;
|
$pages[] = $page;
|
||||||
}
|
}
|
||||||
@ -627,7 +627,7 @@ final class Model
|
|||||||
{
|
{
|
||||||
$pages = [];
|
$pages = [];
|
||||||
|
|
||||||
foreach ($this->getPages([$this, 'getListPages'], strtoupper($type), strtoupper($status)) as $page)
|
foreach ($this->getPages($this->getListPages(...), strtoupper($type), strtoupper($status)) as $page)
|
||||||
{
|
{
|
||||||
$pages[] = $page;
|
$pages[] = $page;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ final class ParallelAPIRequest
|
|||||||
*/
|
*/
|
||||||
public function addRequests(array $requests): self
|
public function addRequests(array $requests): self
|
||||||
{
|
{
|
||||||
array_walk($requests, [$this, 'addRequest']);
|
array_walk($requests, $this->addRequest(...));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ class Controller
|
|||||||
public function notFound(
|
public function notFound(
|
||||||
string $title = 'Sorry, page not found',
|
string $title = 'Sorry, page not found',
|
||||||
string $message = 'Page Not Found'
|
string $message = 'Page Not Found'
|
||||||
): void {
|
): never {
|
||||||
$this->outputHTML('404', [
|
$this->outputHTML('404', [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
|
@ -71,7 +71,7 @@ final class User extends BaseController
|
|||||||
$rawData = $this->kitsuModel->getUserData($username);
|
$rawData = $this->kitsuModel->getUserData($username);
|
||||||
if ($rawData['data']['findProfileBySlug'] === NULL)
|
if ($rawData['data']['findProfileBySlug'] === NULL)
|
||||||
{
|
{
|
||||||
$this->notFound('Sorry, user not found', "The user '$username' does not seem to exist.");
|
$this->notFound('Sorry, user not found', "The user '{$username}' does not seem to exist.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ use Attribute;
|
|||||||
#[Attribute(Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
|
#[Attribute(Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
|
||||||
class Route
|
class Route
|
||||||
{
|
{
|
||||||
public const GET = 'get';
|
final public const GET = 'get';
|
||||||
public const POST = 'post';
|
final public const POST = 'post';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $name,
|
public string $name,
|
||||||
|
@ -33,7 +33,7 @@ abstract class AbstractTransformer implements TransformerInterface
|
|||||||
{
|
{
|
||||||
$list = (array) $collection;
|
$list = (array) $collection;
|
||||||
|
|
||||||
return array_map([$this, 'transform'], $list);
|
return array_map($this->transform(...), $list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user