Example #1
0
 public function testRealizerDoesNotGetConfusedWithMultiLinesVarsAndTemplateNewLines()
 {
     $realizer = new TemplateRealizer(PHP_EOL . '{var}');
     $value = "line1" . PHP_EOL . "line2";
     $expected = PHP_EOL . $value;
     $this->assertEquals($expected, $realizer->realizeVars(array('var' => $value)));
 }
Example #2
0
 /**
  * @param \Phpy\Func\FuncRealizerInterface $funcRealizer
  * @param string $template
  */
 public function __construct(FuncRealizerInterface $funcRealizer = null, $template = "{modifiers} {function}")
 {
     parent::__construct($template);
     if (!isset($funcRealizer)) {
         $funcRealizer = new PhpFuncRealizer();
     }
     $this->funcRealizer = $funcRealizer;
 }
Example #3
0
 /**
  * @param ParameterRealizerInterface $parameterRealizer
  * @param null|string $template
  * @param null $bodyTemplate
  */
 public function __construct(ParameterRealizerInterface $parameterRealizer = null, $template = null, $bodyTemplate = null)
 {
     if (!isset($parameterRealizer)) {
         $parameterRealizer = new PhpParameterRealizer();
     }
     $this->parameterRealizer = $parameterRealizer;
     if (!isset($template)) {
         $template = $this->defaultTemplate;
     }
     if (isset($bodyTemplate)) {
         $this->bodyTemplate = $bodyTemplate;
     }
     parent::__construct($template);
 }
Example #4
0
 /**
  * @param null $template
  * @param \Phpy\Method\MethodRealizerInterface $methodRealizer
  * @param \Phpy\Property\PropertyRealizerInterface $propertyRealizer
  */
 public function __construct($template = null, MethodRealizerInterface $methodRealizer = null, PropertyRealizerInterface $propertyRealizer = null)
 {
     if (!isset($template)) {
         $template = $this->defaultTemplate;
     }
     if (!isset($methodRealizer)) {
         $methodRealizer = new PhpMethodRealizer();
     }
     if (!isset($propertyRealizer)) {
         $propertyRealizer = new PhpPropertyRealizer();
     }
     $this->setMethodRealizer($methodRealizer)->setPropertyRealizer($propertyRealizer);
     parent::__construct($template);
 }
Example #5
0
 /**
  * @param null|string $template     The template to use in the realization
  * @param string $leftDelimiter
  * @param string $rightDelimiter
  */
 public function __construct($template = '{typeHint} {passByRef}${paramName}{defValue}', $leftDelimiter = '{', $rightDelimiter = '}')
 {
     parent::__construct($template, $leftDelimiter, $rightDelimiter);
 }
Example #6
0
 /**
  * @param string $template
  */
 public function __construct($template = '{modifiers} ${propName}{defValue}')
 {
     parent::__construct($template);
 }