sfContext::has PHP Method

has() public method

Returns true if an object is currently stored in the current context with the given name, false otherwise.
public has ( string $name ) : boolean
$name string The object name
return boolean true if the object is not null, false otherwise
    public function has($name)
    {
        return isset($this->factories[$name]);
    }

Usage Example

コード例 #1
0
 /**
  * @param sfContext $context
  */
 public static function addEngineToContext(sfContext $context)
 {
     if (!$context->has(self::SF_CONTEXT_ATTR_NAME)) {
         $context->set(self::SF_CONTEXT_ATTR_NAME, new sfTwigRenderEngine($context));
     }
 }