Swagger\Context::is PHP Method

is() public method

Check if a property is set directly on this context and not its parent context.
public is ( string $type ) : boolean
$type string Example: $c->is('method') or $c->is('class')
return boolean
    public function is($type)
    {
        return property_exists($this, $type);
    }

Usage Example

 /**
  * @param array $properties
  */
 public function __construct($properties)
 {
     if (isset($properties['_context'])) {
         $this->_context = $properties['_context'];
         unset($properties['_context']);
     } elseif (Analyser::$context) {
         $this->_context = Analyser::$context;
     } else {
         $this->_context = Context::detect(1);
     }
     if ($this->_context->is('annotations') === false) {
         $this->_context->annotations = [];
     }
     $this->_context->annotations[] = $this;
     $nestedContext = new Context(['nested' => $this], $this->_context);
     foreach ($properties as $property => $value) {
         if (property_exists($this, $property)) {
             $this->{$property} = $value;
             if (is_array($value)) {
                 foreach ($value as $key => $annotation) {
                     if (is_object($annotation) && $annotation instanceof AbstractAnnotation) {
                         $this->{$property}[$key] = $this->nested($annotation, $nestedContext);
                     }
                 }
             }
         } elseif ($property !== 'value') {
             $this->{$property} = $value;
         } elseif (is_array($value)) {
             $annotations = [];
             foreach ($value as $annotation) {
                 if (is_object($annotation) && $annotation instanceof AbstractAnnotation) {
                     $annotations[] = $annotation;
                 } else {
                     Logger::notice('Unexpected field in ' . $this->identity() . ' in ' . $this->_context);
                 }
             }
             $this->merge($annotations);
         } elseif (is_object($value)) {
             $this->merge([$value]);
         } else {
             Logger::notice('Unexpected parameter in ' . $this->identity());
         }
     }
 }
All Usage Examples Of Swagger\Context::is