[EVENTS] Rename event RouteInFormat
to ControllerResponseInFormat
This commit is contained in:
parent
f371443884
commit
be27a10244
@ -24,7 +24,7 @@ class ActivityStreamsTwo extends Plugin
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $route
|
* @param string $route
|
||||||
* @param array $accept
|
* @param array $accept_header
|
||||||
* @param array $vars
|
* @param array $vars
|
||||||
* @param null|TypeResponse $response
|
* @param null|TypeResponse $response
|
||||||
*
|
*
|
||||||
@ -32,9 +32,9 @@ class ActivityStreamsTwo extends Plugin
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function onRouteInFormat(string $route, array $accept, array $vars, ?TypeResponse &$response = null): bool
|
public function onControllerResponseInFormat(string $route, array $accept_header, array $vars, ?TypeResponse &$response = null): bool
|
||||||
{
|
{
|
||||||
if (empty(array_intersect($this->accept, $accept))) {
|
if (empty(array_intersect($this->accept, $accept_header))) {
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
switch ($route) {
|
switch ($route) {
|
||||||
@ -53,15 +53,14 @@ class ActivityStreamsTwo extends Plugin
|
|||||||
* @param $r RouteLoader the router that was initialized.
|
* @param $r RouteLoader the router that was initialized.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*/
|
||||||
* public function onAddRoute(RouteLoader $r): bool
|
public function onAddRoute(RouteLoader $r): bool
|
||||||
* {
|
{
|
||||||
* $r->connect(
|
$r->connect('note_view_as2',
|
||||||
* 'note_view',
|
'/note/{id<\d+>}',
|
||||||
* '/note/{id<\d+>}',
|
[NoteResponse::class, 'handle'],
|
||||||
* [NoteResponse::class, 'handle'],
|
options: ['accept' => $this->accept]
|
||||||
* options: ['accept' => $this->accept]
|
);
|
||||||
* );
|
return Event::next;
|
||||||
* return Event::next;
|
}
|
||||||
* }*/
|
|
||||||
}
|
}
|
@ -147,7 +147,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getLinkOrNamedObjectValidator(): callable
|
protected function getLinkOrNamedObjectValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_string($item)) {
|
if (is_string($item)) {
|
||||||
return Util::validateUrl($item);
|
return Util::validateUrl($item);
|
||||||
}
|
}
|
||||||
@ -181,7 +183,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getLinkOrUrlObjectValidator(): callable
|
protected function getLinkOrUrlObjectValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
$item = Util::arrayToType($item);
|
$item = Util::arrayToType($item);
|
||||||
}
|
}
|
||||||
@ -207,7 +211,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getAttachmentValidator(): callable
|
protected function getAttachmentValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
$item = Util::arrayToType($item);
|
$item = Util::arrayToType($item);
|
||||||
}
|
}
|
||||||
@ -233,7 +239,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getQuestionAnswerValidator(): callable
|
protected function getQuestionAnswerValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
$item = Util::arrayToType($item);
|
$item = Util::arrayToType($item);
|
||||||
}
|
}
|
||||||
@ -254,7 +262,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getCollectionItemsValidator(): callable
|
protected function getCollectionItemsValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_string($item)) {
|
if (is_string($item)) {
|
||||||
return Util::validateUrl($item);
|
return Util::validateUrl($item);
|
||||||
}
|
}
|
||||||
@ -276,7 +286,9 @@ abstract class ValidatorTools implements ValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function getCollectionActorsValidator(): callable
|
protected function getCollectionActorsValidator(): callable
|
||||||
{
|
{
|
||||||
return static function ($item): bool {
|
return
|
||||||
|
/** The implementation lambda */
|
||||||
|
static function ($item): bool {
|
||||||
if (is_string($item)) {
|
if (is_string($item)) {
|
||||||
return Util::validateUrl($item);
|
return Util::validateUrl($item);
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,9 @@ class Controller extends AbstractController implements EventSubscriberInterface
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$potential_response = null;
|
$potential_response = null;
|
||||||
if (Event::handle('RouteInFormat', [
|
if (Event::handle('ControllerResponseInFormat', [
|
||||||
'route' => $this->vars['controller'][1],
|
'route' => $request->get('_route'),
|
||||||
'accept' => $accept,
|
'accept_header' => $accept,
|
||||||
'vars' => $this->vars,
|
'vars' => $this->vars,
|
||||||
'response' => &$potential_response,
|
'response' => &$potential_response,
|
||||||
])) {
|
])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user