for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* ExcludeAnnotation.php
*
* Jaxon annotation for exclude classes or methods from js export.
* @package jaxon-annotations
* @author Thierry Feuzeu <[email protected]>
* @copyright 2022 Thierry Feuzeu <[email protected]>
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link https://github.com/jaxon-php/jaxon-annotations
*/
namespace Jaxon\Annotations\Annotation;
use Jaxon\App\Metadata\Metadata;
use mindplay\annotations\AnnotationException;
use function count;
use function is_bool;
* Specifies if a class or method is excluded from js export.
* @usage('class' => true, 'method' => true)
class ExcludeAnnotation extends AbstractAnnotation
{
* @var bool
protected $bValue;
* @inheritDoc
public static function parseAnnotation($value)
return [$value === 'true' ? true : ($value === 'false' ? false : $value)];
}
* @throws AnnotationException
public function initAnnotation(array $properties)
if(count($properties) !== 0 && (count($properties) !== 1
|| !isset($properties[0]) || !is_bool($properties[0])))
throw new AnnotationException('the @exclude annotation requires a single boolean or no property');
$this->bValue = $properties[0] ?? true;
public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
$xMetadata->exclude($sMethod)->setValue($this->bValue);