コード例 #1
0
 /**
  * Iterate over class statements looking for class constants. It then makes the constant name uppercase
  * separating each word by underscores.
  *
  * @param ClassyFileEvent $event
  */
 public function onSetClassUpdateConstants(ClassyFileEvent $event)
 {
     $statements = $event->getStatements();
     if ($statements instanceof Class_) {
         $count = count($statements->stmts);
         for ($i = 0; $i < $count; $i++) {
             if (is_array($statements->stmts)) {
                 $statement = $statements->stmts[$i];
                 $this->checkClassConstant($statement);
                 $statements->stmts[$i] = $statement;
             }
         }
     }
     $event->setStatements($statements);
 }
コード例 #2
0
ファイル: GetClassEvent.php プロジェクト: onema/classyfile
 public function __construct(Stmt $statement, $fileLocation = null, $namespace = null, $uses = null, $code = null)
 {
     parent::__construct($statement);
     $this->namespace = $namespace;
     $this->uses = $uses;
     $this->code = $code;
     $this->fileLocation = $fileLocation;
 }