getObjectName() public method

Returns current object name
public getObjectName ( ) : string
return string
Beispiel #1
0
 /**
  * Validates an object
  *
  * @param stdClass           $element object properties
  * @param AbstractSpecObject $schema  schema this object generated of api specification
  */
 protected function checkObject($element, $schema)
 {
     if (isset($schema->sample)) {
         $this->checkSample($element, $schema->sample);
         return;
     }
     if (isset($schema->discriminator)) {
         $discriminator = $schema->discriminator;
         if (!property_exists($element, $discriminator)) {
             $propName = $schema->getObjectName();
             if (isset(static::$ignoreDiscriminatorValues[$propName]) && $discriminator == static::$ignoreDiscriminatorValues[$propName]) {
                 ApiTest::markTestIncomplete(sprintf('%s unexpected discriminator value', $discriminator));
             } else {
                 $this->appendError($discriminator, ' unexpected discriminator value');
             }
             return;
         }
         $schema = $this->getConcreteTypes($schema, $element->{$discriminator});
         if (!$schema) {
             $this->appendError($element->{$discriminator}, ' unexpected concrete type value');
         }
         unset($schema->discriminator);
         $this->check($element, $schema);
         return;
     }
     $properties = $schema instanceof ApiEntity ? $schema->getProperties() : (array) $schema;
     foreach ($element as $p => $value) {
         if (isset($properties[$p])) {
             $this->check($value, $properties[$p]);
         } else {
             $this->appendError($p, "this property don't exist in Api specifications");
         }
     }
     return;
 }
 /**
  *{@inheritdoc}
  * @see \PHPUnit_Framework_Constraint::toString()
  */
 public function toString()
 {
     return $this->specObject->getObjectName();
 }