当前位置: 首页>>代码示例>>PHP>>正文


PHP ParameterGenerator::fromArray方法代码示例

本文整理汇总了PHP中Zend\Code\Generator\ParameterGenerator::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterGenerator::fromArray方法的具体用法?PHP ParameterGenerator::fromArray怎么用?PHP ParameterGenerator::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Code\Generator\ParameterGenerator的用法示例。


在下文中一共展示了ParameterGenerator::fromArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getClassArrayRepresentation

    public function getClassArrayRepresentation()
    {
        $this->data = $this->getData();
        return array('name' => 'Manager', 'namespacename' => $this->data['_namespace'] . '\\Table', 'extendedclass' => $this->tableGatewayClass, 'flags' => ClassGenerator::FLAG_ABSTRACT, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Application Model DbTables', 'longDescription' => null, 'tags' => array(array('name' => 'package', 'description' => $this->data['_namespace']), array('name' => 'author', 'description' => $this->data['_author']), array('name' => 'copyright', 'description' => $this->data['_copyright']), array('name' => 'license', 'description' => $this->data['_license'])))), 'properties' => array(array('entity', null, PropertyGenerator::FLAG_PROTECTED), array('container', null, PropertyGenerator::FLAG_PROTECTED), PropertyGenerator::fromArray(array('name' => 'wasInTransaction', 'defaultvalue' => false, 'flags' => PropertyGenerator::FLAG_PROTECTED, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'True if we were already in a transaction when try to start a new one', 'longDescription' => '', 'tags' => array(new GenericTag('var', 'bool'))))))), 'methods' => array(array('name' => '__construct', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'adapter')), ParameterGenerator::fromArray(array('name' => 'entity', 'type' => 'Entity'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->adapter = $adapter;' . "\n" . '$this->entity = $entity;' . "\n" . '$this->featureSet = new Feature\\FeatureSet();' . "\n" . '$this->initialize();', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Constructor', 'longDescription' => null, 'tags' => array(new ParamTag('adapter', array('Adapter')), new ParamTag('entity', array('Entity')))))), array('name' => 'setContainer', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'c', 'type' => 'Container'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->container = $c;' . "\n" . 'return $this;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Inject container', 'longDescription' => null, 'tags' => array(new ParamTag('c', array('Container')), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getContainer', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->container;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => '', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'Container')))))), array('name' => 'all', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$select = $this->select();' . '$result = array();' . PHP_EOL . 'foreach ($select as $v) {' . PHP_EOL . '     $result[] = $v->getArrayCopy();' . PHP_EOL . '}' . PHP_EOL . 'return $result;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => '', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getPrimaryKeyName', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->id;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => '', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array|string')))))), array('name' => 'getTableName', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->table;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => '', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array|string')))))), array('name' => 'findBy', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'criteria', 'defaultvalue' => array(), 'type' => 'array')), ParameterGenerator::fromArray(array('name' => 'order', 'defaultvalue' => null)), ParameterGenerator::fromArray(array('name' => 'limit', 'defaultvalue' => null)), ParameterGenerator::fromArray(array('name' => 'offset', 'defaultvalue' => null)), ParameterGenerator::fromArray(array('name' => 'toEntity', 'defaultvalue' => false))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$r = $this->sql->select()->where($criteria);' . PHP_EOL . 'if ($order) {' . PHP_EOL . '      $r->order($order);' . PHP_EOL . '}' . PHP_EOL . 'if ($limit) {' . PHP_EOL . '      $r->limit($limit);' . PHP_EOL . '}' . PHP_EOL . 'if ($offset) {' . PHP_EOL . '      $r->offset($offset);' . PHP_EOL . '}' . PHP_EOL . '$result = $this->selectWith($r)->toArray();' . PHP_EOL . 'if ($toEntity) {' . PHP_EOL . '    foreach($result as &$v){' . PHP_EOL . '        $entity =  clone $this->entity;' . PHP_EOL . '        $v = $entity->exchangeArray($v);' . PHP_EOL . '    }' . PHP_EOL . '}' . PHP_EOL . 'return $result;' . PHP_EOL, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Find by criteria', 'longDescription' => null, 'tags' => array(new ParamTag('criteria', array('array'), 'Search criteria'), new ParamTag('order', array('string'), 'sorting option'), new ParamTag('limit', array('int'), 'limit option'), new ParamTag('offset', array('int'), 'offset option'), new ParamTag('toEntity', array('boolean'), 'return entity result'), new ReturnTag(array('array'), ''))))), array('name' => 'countBy', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'criteria', 'defaultvalue' => array(), 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$r = $this->sql->select()->columns(array("count" => new Expression("count(*)")))->where($criteria);' . PHP_EOL . 'return  (int)current($this->selectWith($r)->toArray())["count"];' . PHP_EOL, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Count by criteria', 'longDescription' => null, 'tags' => array(new ParamTag('criteria', array('array'), 'Criteria'), new ReturnTag(array('int'), ''))))), array('name' => 'deleteEntity', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'entity', 'type' => 'Entity')), 'useTransaction = true'), 'flags' => array(MethodGenerator::FLAG_PUBLIC, MethodGenerator::FLAG_ABSTRACT), 'body' => null, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Converts database column name to php setter/getter function name', 'longDescription' => null, 'tags' => array(new ParamTag('entity', array('Entity')), new ParamTag('useTransaction', array('boolean')), new ReturnTag(array('datatype' => 'int')))))), array('name' => 'beginTransaction', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PROTECTED, 'body' => <<<'BODY'
if ($this->adapter->getDriver()->getConnection()->inTransaction()) {
    $this->wasInTransaction = true;

    return;
}
$this->adapter->getDriver()->getConnection()->beginTransaction();
BODY
, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Begin a transaction', 'longDescription' => null, 'tags' => array()))), array('name' => 'rollback', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PROTECTED, 'body' => <<<'BODY'
if ($this->wasInTransaction) {
    throw new \Exception('Inside transaction rollback call');
}
$this->adapter->getDriver()->getConnection()->rollback();
BODY
, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Rollback a transaction', 'longDescription' => null, 'tags' => array()))), array('name' => 'commit', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PROTECTED, 'body' => <<<'BODY'
if (!$this->wasInTransaction) {
    $this->adapter->getDriver()->getConnection()->commit();
}
BODY
, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => ' Commit a transaction', 'longDescription' => null, 'tags' => array())))));
    }
开发者ID:sizrar,项目名称:weez-common,代码行数:24,代码来源:Manager.php

示例2: setParameter

 /**
  * @param  ParameterGenerator|array|string $parameter
  * @throws Exception\InvalidArgumentException
  * @return MethodGenerator
  */
 public function setParameter($parameter)
 {
     if (is_string($parameter)) {
         $parameter = new ParameterGenerator($parameter);
     }
     if (is_array($parameter)) {
         $parameter = ParameterGenerator::fromArray($parameter);
     }
     if (!$parameter instanceof ParameterGenerator) {
         throw new Exception\InvalidArgumentException(sprintf('%s is expecting either a string, array or an instance of %s\\ParameterGenerator', __METHOD__, __NAMESPACE__));
     }
     $this->parameters[$parameter->getName()] = $parameter;
     return $this;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:19,代码来源:MethodGenerator.php

示例3: loadClass

 /**
  * Dynamically scope an audit class
  *
  * @param  string $className
  * @return false|string
  */
 public function loadClass($className, $type)
 {
     $moduleOptions = \ZF\Doctrine\Audit\Module::getModuleOptions();
     if (!$moduleOptions) {
         return;
     }
     $entityManager = $moduleOptions->getEntityManager();
     $auditClass = new ClassGenerator();
     //  Build a discovered many to many join class
     $joinClasses = $moduleOptions->getJoinClasses();
     if (in_array($className, array_keys($joinClasses))) {
         $auditClass->setNamespaceName("ZF\\Doctrine\\Audit\\Entity");
         $auditClass->setName($className);
         $auditClass->setExtendedClass('AbstractAudit');
         $auditClass->addProperty('id', null, PropertyGenerator::FLAG_PROTECTED);
         $auditClass->addProperty('targetRevisionEntity', null, PropertyGenerator::FLAG_PROTECTED);
         $auditClass->addProperty('sourceRevisionEntity', null, PropertyGenerator::FLAG_PROTECTED);
         $auditClass->addMethod('getTargetRevisionEntity', array(), MethodGenerator::FLAG_PUBLIC, 'return $this->targetRevisionEntity;');
         $auditClass->addMethod('getSourceRevisionEntity', array(), MethodGenerator::FLAG_PUBLIC, 'return $this->sourceRevisionEntity;');
         $auditClass->addMethod('getId', array(), MethodGenerator::FLAG_PUBLIC, 'return $this->id;');
         $auditClass->addMethod('setTargetRevisionEntity', array(ParameterGenerator::fromArray(array('name' => 'value', 'type' => '\\ZF\\Doctrine\\Audit\\Entity\\RevisionEntity'))), MethodGenerator::FLAG_PUBLIC, '$this->targetRevisionEntity = $value;' . "\n" . 'return $this;');
         $auditClass->addMethod('setSourceRevisionEntity', array(ParameterGenerator::fromArray(array('name' => 'value', 'type' => '\\ZF\\Doctrine\\Audit\\Entity\\RevisionEntity'))), MethodGenerator::FLAG_PUBLIC, '$this->sourceRevisionEntity = $value;' . "\n" . 'return $this;');
         #            print_r($auditClass->generate());
         #            die();
         eval($auditClass->generate());
         return;
     }
     // Add revision reference getter and setter
     $auditClass->addProperty($moduleOptions->getRevisionEntityFieldName(), null, PropertyGenerator::FLAG_PROTECTED);
     $auditClass->addMethod('get' . $moduleOptions->getRevisionEntityFieldName(), array(), MethodGenerator::FLAG_PUBLIC, " return \$this->" . $moduleOptions->getRevisionEntityFieldName() . ";");
     $auditClass->addMethod('set' . $moduleOptions->getRevisionEntityFieldName(), array('value'), MethodGenerator::FLAG_PUBLIC, " \$this->" . $moduleOptions->getRevisionEntityFieldName() . " = \$value;\nreturn \$this;\r\n            ");
     // Verify this autoloader is used for target class
     #FIXME:  why is this sent work outside the set namespace?
     foreach ($moduleOptions->getAuditedClassNames() as $targetClass => $targetClassOptions) {
         $auditClassName = 'ZF\\Doctrine\\Audit\\Entity\\' . str_replace('\\', '_', $targetClass);
         if ($auditClassName == $className) {
             $currentClass = $targetClass;
         }
         $autoloadClasses[] = $auditClassName;
     }
     if (!in_array($className, $autoloadClasses)) {
         return;
     }
     // Get fields from target entity
     $metadataFactory = $entityManager->getMetadataFactory();
     $auditedClassMetadata = $metadataFactory->getMetadataFor($currentClass);
     $fields = $auditedClassMetadata->getFieldNames();
     $identifiers = $auditedClassMetadata->getFieldNames();
     $service = \ZF\Doctrine\Audit\Module::getModuleOptions()->getAuditService();
     // Generate audit entity
     foreach ($fields as $field) {
         $auditClass->addProperty($field, null, PropertyGenerator::FLAG_PROTECTED);
     }
     foreach ($auditedClassMetadata->getAssociationNames() as $associationName) {
         $auditClass->addProperty($associationName, null, PropertyGenerator::FLAG_PROTECTED);
         $fields[] = $associationName;
     }
     $auditClass->addMethod('getAssociationMappings', array(), MethodGenerator::FLAG_PUBLIC, "return unserialize('" . serialize($auditedClassMetadata->getAssociationMappings()) . "');");
     // Add exchange array method
     $setters = array();
     foreach ($fields as $fieldName) {
         $setters[] = '$this->' . $fieldName . ' = (isset($data["' . $fieldName . '"])) ? $data["' . $fieldName . '"]: null;';
         $arrayCopy[] = "    \"{$fieldName}\"" . ' => $this->' . $fieldName;
     }
     $auditClass->addMethod('getArrayCopy', array(), MethodGenerator::FLAG_PUBLIC, "return array(\n" . implode(",\n", $arrayCopy) . "\n);");
     $auditClass->addMethod('exchangeArray', array('data'), MethodGenerator::FLAG_PUBLIC, implode("\n", $setters));
     // Add function to return the entity class this entity audits
     $auditClass->addMethod('getAuditedEntityClass', array(), MethodGenerator::FLAG_PUBLIC, " return '" . addslashes($currentClass) . "';");
     $auditClass->setNamespaceName("ZF\\Doctrine\\Audit\\Entity");
     $auditClass->setName(str_replace('\\', '_', $currentClass));
     $auditClass->setExtendedClass('AbstractAudit');
     #    $auditedClassMetadata = $metadataFactory->getMetadataFor($currentClass);
     $auditedClassMetadata = $metadataFactory->getMetadataFor($currentClass);
     foreach ($auditedClassMetadata->getAssociationMappings() as $mapping) {
         if (isset($mapping['joinTable']['name'])) {
             $auditJoinTableClassName = "ZF\\Doctrine\\Audit\\Entity\\" . str_replace('\\', '_', $mapping['joinTable']['name']);
             $auditEntities[] = $auditJoinTableClassName;
             $moduleOptions->addJoinClass($auditJoinTableClassName, $mapping);
         }
     }
     #        if ($auditClass->getName() == 'AppleConnect_Entity_UserAuthenticationLog') {
     #            echo '<pre>';
     #            echo($auditClass->generate());
     #            die();
     #        }
     eval($auditClass->generate());
     #            die();
     return true;
 }
开发者ID:TomHAnderson,项目名称:SoliantEntityAudit,代码行数:95,代码来源:AuditAutoloader.php

示例4: testCreateFromArray

    public function testCreateFromArray()
    {
        $parameterGenerator = ParameterGenerator::fromArray(array(
            'name'              => 'SampleParameter',
            'type'              => 'int',
            'defaultvalue'      => 'foo',
            'passedbyreference' => false,
            'position'          => 1,
            'sourcedirty'       => false,
            'sourcecontent'     => 'foo',
            'indentation'       => '-',
        ));

        $this->assertEquals('SampleParameter', $parameterGenerator->getName());
        $this->assertEquals('int', $parameterGenerator->getType());
        $this->assertInstanceOf('Zend\Code\Generator\ValueGenerator', $parameterGenerator->getDefaultValue());
        $this->assertFalse($parameterGenerator->getPassedByReference());
        $this->assertEquals(1, $parameterGenerator->getPosition());
        $this->assertFalse($parameterGenerator->isSourceDirty());
        $this->assertEquals('foo', $parameterGenerator->getSourceContent());
        $this->assertEquals('-', $parameterGenerator->getIndentation());
    }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:22,代码来源:ParameterGeneratorTest.php

示例5: getUtils

 private function getUtils()
 {
     $constructBody = '';
     foreach ($this->data['_columns'] as $column) {
         $constructBody .= '$this->' . $column['capital'] . ' = (isset($data[\'' . $column['field'] . '\'] )) ? $data[\'' . $column['field'] . '\'] : null;' . PHP_EOL;
     }
     $constructBody .= 'return $this;';
     $methods[] = array('name' => 'exchangeArray', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'data', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => $constructBody, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Array of options/values to be set for this model.', 'longDescription' => 'Options without a matching method are ignored.', 'tags' => array(new ParamTag('data', array('array'), 'array of values to set'), new ReturnTag(array('datatype' => 'self'))))));
     $constructBody = '';
     $constructBody .= '$result = array(' . PHP_EOL;
     foreach ($this->data['_columns'] as $column) {
         $constructBody .= '     \'' . $column['field'] . '\' => $this->get' . $column['capital'] . '(),' . PHP_EOL;
     }
     $constructBody .= ');' . PHP_EOL;
     $constructBody .= 'return $result;' . PHP_EOL;
     $methods[] = array('name' => 'toArray', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => $constructBody, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Returns an array, keys are the field names.', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array'))))));
     return $methods;
 }
开发者ID:sizrar,项目名称:weez-common,代码行数:18,代码来源:EntityItem.php

示例6: getClassArrayRepresentation

 public function getClassArrayRepresentation()
 {
     $data = $this->getData();
     return array('name' => 'Entity', 'namespacename' => $data['_namespace'] . '\\Entity', 'flags' => ClassGenerator::FLAG_ABSTRACT, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Generic Entity Class', 'longDescription' => null, 'tags' => array(array('name' => 'package', 'description' => $data['_namespace']), array('name' => 'author', 'description' => $data['_author']), array('name' => 'copyright', 'description' => $data['_copyright']), array('name' => 'license', 'description' => $data['_license'])))), 'methods' => array(array('name' => 'setColumnsList', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'data', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->_columnsList = $data;' . "\n" . 'return $this;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Set the list of columns associated with this model', 'longDescription' => null, 'tags' => array(new ParamTag('data', array('array'), 'array of field names'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getColumnsList', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->_columnsList;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Returns columns list array', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array')))))), array('name' => 'setParentList', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'data', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->_parentList = $data;' . "\n" . 'return $this;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Set the list of relationships associated with this model', 'longDescription' => null, 'tags' => array(new ParamTag('data', array('array'), 'Array of relationship'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getParentList', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->_parentList;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Returns relationship list array', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array')))))), array('name' => 'setDependentList', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'data', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->_dependentList = $data;' . "\n" . 'return $this;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Set the list of relationships associated with this model', 'longDescription' => null, 'tags' => array(new ParamTag('data', array('array'), 'array of relationships'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getDependentList', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return $this->_dependentList;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Returns relationship list array', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array')))))), array('name' => 'columnNameToVar', 'parameters' => array('column'), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'if (! isset($this->_columnsList[$column])) {' . "\n" . '    throw new \\Exception("column \'$column\' not found!");' . "\n" . '}' . "\n" . 'return $this->_columnsList[$column];', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Converts database column name to php setter/getter function name', 'longDescription' => null, 'tags' => array(new ParamTag('column', array('string'), 'Column name'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'varNameToColumn', 'parameters' => array('thevar'), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'foreach ($this->_columnsList as $column => $var) {' . "\n" . '    if ($var == $thevar) {' . "\n" . '        return $column;' . "\n" . '    }' . "\n" . '}' . "\n" . 'return null;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Converts database column name to PHP setter/getter function name', 'longDescription' => null, 'tags' => array(new ParamTag('thevar', array('string'), 'Column name'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'setOptions', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'options', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => '$this->exchangeArray($options);' . "\n" . 'return $this;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Array of options/values to be set for this model.', 'longDescription' => 'Options without a matching method are ignored.', 'tags' => array(new ParamTag('options', array('array'), 'array of Options'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'exchangeArray', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'options', 'type' => 'array'))), 'flags' => MethodGenerator::FLAG_ABSTRACT, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Array of options/values to be set for this model.', 'longDescription' => 'Options without a matching method are ignored.', 'tags' => array(new ParamTag('options', array('array'), 'array of Options'), new ReturnTag(array('datatype' => 'self')))))), array('name' => 'getPrimaryKey', 'parameters' => array(), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => 'return  $this->primary_key;', 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Returns primary key.', 'longDescription' => null, 'tags' => array(new ReturnTag(array('datatype' => 'array|string'))))))));
 }
开发者ID:sizrar,项目名称:weez-common,代码行数:5,代码来源:Entity.php

示例7: getUtils

    private function getUtils()
    {
        $constructBody = 'return $this->adapter->platform->quoteIdentifier($name);
';
        $methods[] = array('name' => 'qi', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'name', 'type' => 'string'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => $constructBody, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Apply quoteIdentifier', 'longDescription' => null, 'tags' => array(new ParamTag('name', array('string'), 'String to quote'), new ReturnTag(array('datatype' => 'string'), 'Quoted string')))));
        $constructBody = 'return $this->adapter->driver->formatParameterName($name);
';
        $methods[] = array('name' => 'fp', 'parameters' => array(ParameterGenerator::fromArray(array('name' => 'name', 'type' => 'string'))), 'flags' => MethodGenerator::FLAG_PUBLIC, 'body' => $constructBody, 'docblock' => DocBlockGenerator::fromArray(array('shortDescription' => 'Apply formatParameterName', 'longDescription' => null, 'tags' => array(new ParamTag('name', array('string'), 'Parameter name to format'), new ReturnTag(array('datatype' => 'string'), 'Formated parameter name')))));
        return $methods;
    }
开发者ID:sizrar,项目名称:weez-common,代码行数:10,代码来源:EntityManager.php


注:本文中的Zend\Code\Generator\ParameterGenerator::fromArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。