Skip to content

Commit

Permalink
Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jul 16, 2018
1 parent 527a0a2 commit 9f5a234
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/DI/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Helpers
public static function sort(array $definitions, int $default = 10): array
{
// Sort by priority
uasort($definitions, function (int $a, int $b) use ($default) {
uasort($definitions, function (array $a, array $b) use ($default) {
$p1 = $a['priority'] ?? $default;
$p2 = $b['priority'] ?? $default;

Expand Down
4 changes: 2 additions & 2 deletions src/DI/Plugin/PluginCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public function getPlugin(string $name): ?AbstractPlugin
{
$plugins = $this->manager->getPlugins();

return $plugins[$name] ?? null;
return $plugins[$name]['inst'] ?? null;
}

public function getPluginByType(string $class): ?AbstractPlugin
{
foreach ($this->manager->getPlugins() as $plugin) {
if (get_class($plugin['inst']) === $class) return $plugin;
if (get_class($plugin['inst']) === $class) return $plugin['inst'];
}

return null;
Expand Down
5 changes: 4 additions & 1 deletion src/Handler/ServiceCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public function setArguments(array $args): void
$this->arguments = $args;
}

public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
/**
* @return mixed
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
{
return call_user_func_array([$this->service, $this->method], $this->arguments);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function withEntity(AbstractEntity $entity): self
return $this->withAttribute(ResponseAttributes::ATTR_ENTITY, $entity);
}

public function getEndpoint(): Endpoint
public function getEndpoint(): ?Endpoint
{
return $this->getAttribute(ResponseAttributes::ATTR_ENDPOINT, null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Builder/Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function addGroupPath(string $path): void
$this->groupPaths[] = $path;
}

public function addTag(string $name, string $value): void
public function addTag(string $name, ?string $value): void
{
$this->tags[$name] = $value;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Schema/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ final class Endpoint

// Tags
public const TAG_ID = 'id';
public const TAG_GROUP_IDS = 'group.ids';
public const TAG_GROUP_PATHS = 'group.paths';

/** @var string[] */
private $methods = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/EndpointNegotiation.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getRenderer(): ?string
return $this->renderer;
}

public function setRenderer(string $renderer): void
public function setRenderer(?string $renderer): void
{
$this->renderer = $renderer;
}
Expand Down
8 changes: 0 additions & 8 deletions src/Schema/SchemaInspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ public function __construct(Schema $schema)
$this->schema = $schema;
}

/**
* @return Endpoint[]
*/
public function getEndpointByGroup(string $group): array
{
return $this->getEndpointsByTag(Endpoint::TAG_GROUP_IDS, $group);
}

/**
* @return Endpoint[]
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Schema/Serialization/ArrayHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ protected function hydrateEndpoint(array $data): Endpoint
$handler->setArguments($data['handler']['arguments']);
$endpoint->setHandler($handler);

if (isset($data['id'])) {
$endpoint->addTag(Endpoint::TAG_ID, $data['id']);
}

if (isset($data['tags'])) {
foreach ($data['tags'] as $name => $value) {
$endpoint->addTag($name, $value);
}
}

if (isset($data['id'])) {
$endpoint->addTag(Endpoint::TAG_ID, $data['id']);
}

if (isset($data['attributes']['pattern'])) {
$endpoint->setAttribute('pattern', $data['attributes']['pattern']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Serialization/ArraySerializator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function serializeInit(Controller $controller, Method $method): array
'arguments' => $method->getArguments(),
],
'id' => $id,
'tags' => $method->getTags(),
'tags' => array_merge($controller->getTags(), $method->getTags()),
'methods' => $method->getMethods(),
'mask' => $mask,
'description' => $method->getDescription(),
Expand Down

0 comments on commit 9f5a234

Please sign in to comment.