Generate a context for docgen, on accompanying period

This commit is contained in:
2021-11-30 23:23:02 +01:00
parent 3404d3669c
commit de4e83b3fb
19 changed files with 433 additions and 128 deletions

View File

@@ -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;

View File

@@ -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.
*/

View File

@@ -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)));
}
}

View File

@@ -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.
*/