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


PHP FileGenerator::getFilename方法代码示例

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


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

示例1: registerFileCodeGenerator

 /**
  * Registry for the Zend\Code package.
  *
  * @param  FileGenerator $fileCodeGenerator
  * @param  string $fileName
  * @throws RuntimeException
  */
 public static function registerFileCodeGenerator(FileGenerator $fileCodeGenerator, $fileName = null)
 {
     if ($fileName === null) {
         $fileName = $fileCodeGenerator->getFilename();
     }
     if ($fileName == '') {
         throw new RuntimeException('FileName does not exist.');
     }
     // cannot use realpath since the file might not exist, but we do need to have the index
     // in the same DIRECTORY_SEPARATOR that realpath would use:
     $fileName = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $fileName);
     static::$fileCodeGenerators[$fileName] = $fileCodeGenerator;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:20,代码来源:FileGeneratorRegistry.php

示例2: writeClass

 /**
  * @inheritDoc
  */
 public function writeClass(FileGenerator $fileGenerator)
 {
     file_put_contents($fileGenerator->getFilename(), $this->replaceNamespace($fileGenerator));
 }
开发者ID:proophsoftware,项目名称:prooph-cli,代码行数:7,代码来源:AddEventToAggregate.php

示例3: generateModelFromMetadata

 /**
  * Generate Madel class from metadata
  *
  * @param  stdClass                      $metadata
  * @return Generator\ClassGenerator|null
  */
 protected function generateModelFromMetadata($metadata)
 {
     $console = $this->getServiceLocator()->get('console');
     $name = $metadata->Name;
     $ucName = ucfirst($name);
     // Create Api Class
     $class = new Generator\ClassGenerator($ucName, 'Mailjet\\Model');
     $class->setImplementedInterfaces(array('ModelInterface'))->setDocBlock(new Generator\DocBlockGenerator($class->getName() . ' Model', $metadata->Description, array()));
     $this->addProperties($class, $metadata->Properties);
     // Create and Write Api Class File
     $file = new Generator\FileGenerator();
     $file->setClass($class);
     $file->setDocBlock(new Generator\DocBlockGenerator('MailJet Model', self::LICENSE));
     $file->setFilename(dirname(__DIR__) . '/Model/' . $class->getName() . '.php');
     if (file_put_contents($file->getFilename(), $file->generate())) {
         $console->writeLine(sprintf("The Model '%s' has been created.", $class->getName()), Color::GREEN);
         return $class;
     } else {
         $console->writeLine(sprintf("There was an error during '%s' Model creation.", $class->getName()), Color::RED);
     }
     return $class;
 }
开发者ID:progrupa,项目名称:MailjetBundle,代码行数:28,代码来源:ApiController.php

示例4: writeClass

 /**
  * @inheritDoc
  */
 public function writeClass(FileGenerator $fileGenerator)
 {
     file_put_contents($fileGenerator->getFilename(), $fileGenerator->generate());
 }
开发者ID:sandrokeil,项目名称:prooph-cli,代码行数:7,代码来源:AddEventToAggregate.php

示例5: writeClass

 /**
  * Function writeClass.
  *
  * @param ClassGenerator $class
  * @param Filesystem     $filesystem
  * @param $destinationDir
  *
  * @return string|false
  *
  * @throws CliException
  */
 protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
 {
     $className = $class->getName();
     $file = new FileGenerator(['fileName' => $className . '.php', 'classes' => [$class]]);
     $contents = $file->generate();
     $relativePath = $destinationDir . DIRECTORY_SEPARATOR . $file->getFilename();
     if ($filesystem->has($relativePath)) {
         throw new CliException(sprintf('Could not generate migration. File already exists: %s', $relativePath));
     }
     $result = $filesystem->write($relativePath, $contents);
     return $result ? $relativePath : false;
 }
开发者ID:baleen,项目名称:cli,代码行数:23,代码来源:CreateHandler.php


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