lean/src/Application.php

77 lines
1.6 KiB
PHP

<?php
namespace Lean;
class Application
{
public string $name;
public /*string|array*/ $piceaContext;
public array $piceaExtensions;
public array $views;
public array $routes;
public array $cronard;
public array $entities;
public array $tellJson;
public array $tellPhp;
public array $data = [];
public function __construct(string $name) {
$this->name = $name;
}
public function fromArray(array $data) : self
{
$this->data = array_replace($this->data, $data);
if (is_array($picea = $data['picea'] ?? false)) {
if ($picea['context'] ?? false ) {
$this->piceaContext = $picea['context'];
}
if ($picea['extensions'] ?? false ) {
$this->piceaExtensions = $picea['extensions'];
}
if ($picea['view'] ?? false) {
$this->views = $picea['view'];
}
}
if (is_array($ulmus = $data['ulmus'] ?? false)) {
if ($ulmus['entities'] ?? false) {
$this->entities = $ulmus['entities'];
}
}
if (is_array($tell = $data['tell'] ?? false)) {
if ($tell['json'] ?? false) {
$this->tellJson = $tell['json'];
}
if ($tell['php'] ?? false) {
$this->tellPhp = $tell['php'];
}
}
if (is_array($data['routes'] ?? false)) {
$this->routes = $data['routes'];
}
if (is_array($data['cronard'] ?? false)) {
$this->cronard = $data['cronard'];
}
return $this;
}
}