Create new document

Create a new document of the given type and return it. Throws a
phpillowNoSuchPropertyException if the document does not exist.

@param string $name
@return phpillowDocument
961381
public static function createDocument( $name )
    {
        // Check if a document with the given name exists.
        if ( !isset( self::$documents[$name] ) )
        {
            throw new phpillowNoSuchPropertyException( $name );
        }

        // Instantiate and return document.
        $className = self::$documents[$name];
        return call_user_func( array( $className, 'createNew' ) );
    }
366951
public function createElement($name)
    {
        $elementClass = $this->classNameResolver->resolveElement($name);

        return $this->instantiateElement($elementClass);
    }
1071702
public static function create($name)
    {
        $db = Loader::db();
        $u = new User();
        $v = array($u->getUserID(), 0, $name, 'READY');
        $q = "insert into Piles (uID, isDefault, name, state) values (?, ?, ?, ?)";
        $r = $db->query($q, $v);
        if ($r) {
            $pID = $db->Insert_ID();

            return self::get($pID);
        }
    }
412902
public static function Create( $name )
	{
		if ( $name == "" || $name == "empty-sequence()")
			return null;
		else
		{
			/**
			 * @var XmlTypeCardinality $cardinality
			 */
			$cardinality = XmlTypeCardinality::One;
			if ( SchemaTypes::endsWith( $name, "?" ) )
			{
				$cardinality = XmlTypeCardinality::ZeroOrOne;
				$name = substr( $name, 1, strlen( $name ) - 1 );
			}
			else if ( SchemaTypes::endsWith( $name,"+") )
			{
				$cardinality = XmlTypeCardinality::OneOrMore;
				$name = substr( $name, 1, strlen( $name ) - 1 );
			}
			else if ( SchemaTypes::endsWith( $name, "*" ) )
			{
				$cardinality = XmlTypeCardinality::ZeroOrMore;
				$name = substr( $name, 1, strlen( $name ) - 1 );
			}
			if ( $name == "xs:AnyAtomicType" )
			{
				return SequenceType::WithSchemaTypeWithCardinality( XmlSchema::$AnyAtomicType /* DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::AnyAtomicType ) */, $cardinality );
			}
			else if ( $name == "item()" )
			{
				return SequenceType::WithTypeCodeAndCardinality( XmlTypeCode::Item, $cardinality);
			}
			else if ( $name == "node()" )
			{
				return SequenceType::WithTypeCodeAndCardinality( XmlTypeCode::Node, $cardinality );
			}
			else
			{
				/**
				 * @var QName $qname
				 */
				$qname = \lyquidity\xml\qname( $name, array( SCHEMA_PREFIX => SCHEMA_NAMESPACE ) + SchemaTypes::getInstance()->getProcessedSchemas() );
				$prefix = $qname->prefix;
				$localName = $qname->localName;

				if ( $prefix != SCHEMA_PREFIX && $prefix != SCHEMA_PREFIX_ALTERNATIVE )
				{
					throw new ArgumentException( "$name" );
				}

				$schemaType = DOMSchemaType::GetBuiltInSimpleTypeByQName( $qname );
				if ( is_null( $schemaType ) )
				{
					throw new ArgumentException( "Failed to create a built-in schema type with name: $name" );
				}

				return SequenceType::WithSchemaTypeWithCardinality( $schemaType, $cardinality );
			}
		}
	}
938338
public function getFile( $fileName )
    {
        if ( !isset( $this->storage->_attachments[$fileName] ) )
        {
            throw new phpillowNoSuchPropertyException( $fileName );
        }

        $attachment = $this->storage->_attachments[$fileName];

        return new phpillowLazyFile(
            $this->getConnection(),
            $this->getDatabase() . urlencode( $this->_id ) . '/' . $fileName,
            $attachment['content_type'],
            $attachment['length']
        );
    }
456591
public function create($name)
    {
        $class = $this->class;
        /** @var Group $group */
        $group = new $class($name, $this->dispatcher);
        $this->groups[$group->getName()] = $group;

        return $group;
    }
683638
public function create($name)
    {
        $this->checkName($name);

        $configuration = new Configuration();

        $configuration->setName($name);

        $configuration->setModel($this->getParameter($name, 'model'));
        $configuration->setForm($this->getParameter($name, 'form'));
        $configuration->setFormTemplate($this->getParameter($name, 'template.form'));
        $configuration->setRecipientTemplate($this->getParameter($name, 'template.recipient'));
        $configuration->setRecipient($this->getParameter($name, 'recipient'));
        $configuration->setConfirmTemplate($this->getParameter($name, 'template.confirm'));
        $configuration->setPageTemplate($this->getParameter($name, 'template.page'));
        $configuration->setFrom($this->getParameter($name, 'from'));
        $configuration->setSenderName($this->getParameter($name, 'sender_name'));
        $configuration->setSubject($this->getParameter($name, 'subject'));
        $configuration->setTranslationDomain($this->getParameter($name, 'translation_domain'));
        $configuration->setConfirmMail($this->getParameter($name, 'confirm_mail'));

        return $configuration;
    }
129144
public static function newInstance($name)
    {
        $bean       = \Mix\Core\Bean::config($name);
        $class      = $bean['class'];
        $properties = $bean['properties'] ?? [];
        return new $class($properties);
    }
1289243
public static function create($name)
    {
        $logger = new Logger($name);

        $localLogConfig = config('logger.local_log');
        if($localLogConfig['enabled'] && !in_array($name, $localLogConfig['exclude_names'])) {
            $streamHandler = self::streamHandler($name);
            $logger->pushHandler($streamHandler);
        }

        $logstashConfig = config('logger.logstash');
        if($logstashConfig['enabled'] && !in_array($name, $logstashConfig['exclude_names'])){
            $gelfHandler = self::logStashHandler($logstashConfig);
            $logger->pushHandler($gelfHandler);
        }

        $requestId = Request::header('x-request-id');
        $logger->setRequestId($requestId);

        return $logger;
    }
456536
public static function create(string $contents)
    {
        $contextInst = new ContextFactory();

        $context = function (string $namespace) use ($contents, $contextInst) {
            return $contextInst->createForNamespace($namespace, $contents);
        };

        $phpdocInst = DocBlockFactory::createInstance();

        $phpdoc = function (string $doc, Context $context) use ($phpdocInst) {
            return $phpdocInst->create($doc, $context);
        };

        return new self($context, $phpdoc);
    }
358215
public function createDocument(Extensions $extensions, $name)
    {
        switch ($name) {
            case 'app:service':
                // No document — no exception.
                return new ServiceDocument($extensions);
            case 'app:categories':
                // No document — no exception.
                return new CategoryDocument($extensions);
        }

        return null;
    }
96601
public function createConstant($name, $type = NULL, $default = self::UNDEFINED, $modifiers = GConstant::MODIFIER_PROTECTED) {
    $gConstant = GConstant::create($name, $type, $default, $modifiers);
    
    $this->addConstant($gConstant);
    return $gConstant;
  }
405605
public static function create( $name = null, $conf = null ) 
	{
		if ( is_null( $name ) ) 
		{
			$name = static::$_default;
		}

		if ( !is_null( $conf ) && is_array( $conf ) )
		{
			return static::$_instances[$name] = new static( $name, $conf );
		}

		if ( !isset( static::$_instances[$name] ) )
		{
			static::$_instances[$name] = new static( $name );
		}

		return static::$_instances[$name];
	}
1077716
public static function getView( $name )
    {
        // Check if a view with the given name exists.
        if ( !isset( self::$views[$name] ) )
        {
            throw new phpillowNoSuchPropertyException( $name );
        }

        // Instantiate and return view.
        $className = self::$views[$name];
        return new $className;
    }
30496
public function createDocument($uid, $document, $indexName = '', $indexType = '')
    {
        return new Document($uid, $document, $indexType, $indexName);
    }
1305427
public function createEnvironment($name)
    {
        if (false == $this->vagrentExists($name)) {
            $msg = self::VAGRANT_FILE_NAME." not found in {$name}, skipping";
            $this->printLn($msg, 'error');
            return;
        }
        $environments       = $this->getEnvironments();
        $changed            = false;
        if (false == $this->environmentExists($name)) {
            $environments[] = $name;
            $changed        = true;
            $this->printLn("Environment {$name} created");
        }
        if (true == $changed) {
            $this->setEnvironments($environments);
            $environments   = array_reverse($environments);
            $this->setEnvironments($environments);
        } else {
            $message = "Environment {$name} already exists, skipping";
            $this->printLn($message, 'notice', false);
        }
        return $this;
    }
754457
public function createDocument($name)
    {
        foreach ($this->registry[DocumentExtension::class] as $extension) {
            $node = $extension->createDocument($this, $name);
            if ($node) {
                return $node;
            }
        }

        return null;
    }