17    private $canonical_name = 
null;
 
   27        if ($this->canonical_name === 
null) {
 
   30        return $this->canonical_name;
 
   40        $cls = explode(
"\\", get_class($this));
 
   42        $cur = array_pop($cls);
 
   43        while ($cur !== 
"Component" && count($cls) > 0) {
 
   44            $name[] = preg_replace(
"%([a-z])([A-Z])%", 
"$1 $2", $cur);
 
   45            $cur = array_pop($cls);
 
   47        return implode(
" ", 
$name);
 
   63        assert(is_string($which));
 
   64        assert(is_bool($check));
 
   67            throw new \InvalidArgumentException(
"Argument '$which': $message");
 
  109            is_string($value) || $value instanceof 
Signal,
 
  166        if (!is_object($value)) {
 
  167            $message = 
"expected $name, got '$value'";
 
  169            $message = 
"expected $name, got object.";
 
  198        if ($failed_k !== 
null) {
 
  204        $this->
checkArg($which, $failed_k === 
null, 
$m);
 
  219        $classes = $this->
toArray($classes);
 
  221            foreach ($classes as $cls) {
 
  222                if ($cls === 
"string" && is_string($value)) {
 
  225                if ($cls === 
"int" && is_int($value)) {
 
  227                } elseif ($value instanceof $cls) {
 
  232        }, 
function ($_, 
$failed) use (&$classes) {
 
  245        if (is_array($value)) {
 
  248        return array($value);
 
  253        $type = gettype($value);
 
  254        if (!is_object($value) && !is_array($value)) {
 
  255            return "expected $expected, got $type '$value'";
 
  257            if (is_object($value)) {
 
  258                $type = get_class($value);
 
  260            return "expected $expected, got $type";
 
An exception for terminatinating execution or to throw for unit testing.
getCanonicalName()
Get the canonical name of the component.
catch(Exception $e) $message
checkStringOrSignalArg($which, $value)
Throw an InvalidArgumentException if $value is no string or Signal.
checkArgList($which, array &$values, \Closure $check, \Closure $message)
Check every key and value of the list with a supplied closure.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
checkArg($which, $check, $message)
/** Throw an InvalidArgumentException containing the message if $check is false.
checkIntArg($which, $value)
Throw an InvalidArgumentException if $value is no int.
toArray($value)
Wrap the given value in an array if it is no array.
checkArgListElements($which, array &$values, &$classes)
Check every element of the list if it is an instance of one of the given classes.
wrongTypeMessage($expected, $value)
checkBoolArg($which, $value)
Throw an InvalidArgumentException if $value is not a bool.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.
checkFloatArg($which, $value)
Throw an InvalidArgumentException if $value is not a float.
checkArgInstanceOf($which, $value, $class)
Throw an InvalidArgumentException if $value is not an instance of $class.
getCanonicalNameByFullyQualifiedName()
Does the calculation required for getCanonicalName.