mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 07:33:50 +00:00
Generate a context for docgen, on accompanying period
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Context;
|
||||
|
||||
class ContextManager
|
||||
{
|
||||
private iterable $contexts;
|
||||
|
||||
/**
|
||||
* @param iterable $contexts
|
||||
*/
|
||||
public function __construct(iterable $contexts)
|
||||
{
|
||||
$this->contexts = $contexts;
|
||||
|
@@ -16,11 +16,6 @@ namespace Chill\DocGeneratorBundle\Context;
|
||||
*/
|
||||
interface DocGeneratorContextInterface
|
||||
{
|
||||
|
||||
public static function getKey(): string;
|
||||
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* Get the data that will be injected to the generated document.
|
||||
*
|
||||
@@ -35,6 +30,10 @@ interface DocGeneratorContextInterface
|
||||
*/
|
||||
public function getForm($entity);
|
||||
|
||||
public static function getKey(): string;
|
||||
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* has form.
|
||||
*/
|
||||
|
@@ -1,11 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Context\Exception;
|
||||
|
||||
class UnexpectedTypeException extends \LogicException
|
||||
use LogicException;
|
||||
use function get_class;
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
|
||||
class UnexpectedTypeException extends LogicException
|
||||
{
|
||||
public function __construct($value, string $expectedType)
|
||||
{
|
||||
parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, \is_object($value) ? \get_class($value) : \gettype($value)));
|
||||
parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
|
||||
}
|
||||
}
|
||||
|
@@ -23,16 +23,6 @@ use function get_class;
|
||||
*/
|
||||
class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
||||
{
|
||||
public function getName(): string
|
||||
{
|
||||
return 'household member';
|
||||
}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
return self::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data that will be injected to the generated document.
|
||||
*
|
||||
@@ -99,6 +89,16 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'household member';
|
||||
}
|
||||
|
||||
/**
|
||||
* has form.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user