-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6d6886
commit f964cb0
Showing
2 changed files
with
47 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Lenra\App\Manifest; | ||
|
||
use Lenra\App\Components\View; | ||
|
||
class Exposer implements \JsonSerializable { | ||
protected string $version; | ||
/** | ||
* @var Route[] | ||
*/ | ||
protected array $routes; | ||
|
||
/** | ||
* @param string | ||
* @param Route[] | ||
*/ | ||
public function __construct( | ||
string $version, | ||
array $routes | ||
) { | ||
$this->version = $version; | ||
$this->routes = $routes; | ||
} | ||
|
||
public function jsonSerialize() { | ||
return [ | ||
'version' => $this->version, | ||
'routes' => array_map(function ($route) { | ||
return $route->jsonSerialize(); | ||
}, $this->routes), | ||
]; | ||
} | ||
} |