File: vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php

Recommend this page to a friend!
  Classes of Renato De Oliveira Lucena  >  PHP Pokemon Script  >  vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php  >  Download  
File: vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Pokemon Script
Provides an API to manage a database of Pokemons
Author: By
Last change:
Date: 2 years ago
Size: 931 bytes
 

Contents

Class file image Download
<?php

/*
 Copyright (c) 2009 hamcrest.org
 */

class GlobalFunctionFile extends FactoryFile
{
   
/**
     * @var string containing function definitions
     */
   
private $functions;

    public function
__construct($file)
    {
       
parent::__construct($file, ' ');
       
$this->functions = '';
    }

    public function
addCall(FactoryCall $call)
    {
       
$this->functions .= PHP_EOL . $this->generateFactoryCall($call);
    }

    public function
build()
    {
       
$this->addFileHeader();
       
$this->addPart('functions_imports');
       
$this->addPart('functions_header');
       
$this->addCode($this->functions);
       
$this->addPart('functions_footer');
    }

    public function
generateFactoryCall(FactoryCall $call)
    {
       
$code = "if (!function_exists('{$call->getName()}')) {";
       
$code.= parent::generateFactoryCall($call);
       
$code.= "}\n";

        return
$code;
    }
}


For more information send a message to info at phpclasses dot org.