unexpectedModel() public static method

public static unexpectedModel ( string $expected, string $received ) : InvalidArgumentException
$expected string
$received string
return InvalidArgumentException
Example #1
0
 /**
  * @param TypeSchema $definition
  * @return bool
  * @throws InvalidArgumentException
  */
 public function isValid(TypeSchema $definition) : bool
 {
     if (mb_strtolower($definition->name()) !== mb_strtolower($this->typeSchemaName())) {
         throw InvalidArgumentException::unexpectedModel($definition->name(), $this->typeSchemaName());
     }
     foreach ($this->fields as $fieldName => $value) {
         $field = $definition->getFieldDefinition($fieldName);
         if (!$field->isValid($value)) {
             return false;
         }
     }
     return true;
 }