Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • Symfony\Component\Yaml\Tests\A
  • Symfony\Component\Yaml\Tests\B
  • Symfony\Component\Yaml\Tests\DumperTest
  • Symfony\Component\Yaml\Tests\InlineTest
  • Symfony\Component\Yaml\Tests\ParseExceptionTest
  • Symfony\Component\Yaml\Tests\ParserTest
  • Symfony\Component\Yaml\Tests\YamlTest
  • Overview
  • Namespace
  • Function
  • Tree
 1: <?php
 2: 
 3: namespace Mockery\Generator;
 4: 
 5: class Parameter
 6: {
 7:     private static $parameterCounter;
 8: 
 9:     private $rfp;
10: 
11:     public function __construct(\ReflectionParameter $rfp)
12:     {
13:         $this->rfp = $rfp;
14:     }
15: 
16:     public function __call($method, array $args)
17:     {
18:         return call_user_func_array(array($this->rfp, $method), $args);
19:     }
20: 
21:     public function getClass()
22:     {
23:         return new DefinedTargetClass($this->rfp->getClass());
24:     }
25: 
26:     public function getTypeHintAsString()
27:     {
28:         if (method_exists($this->rfp, 'getTypehintText')) {
29:             // Available in HHVM
30:             $typehint = $this->rfp->getTypehintText();
31: 
32:             // not exhaustive, but will do for now
33:             if (in_array($typehint, array('int', 'integer', 'float', 'string', 'bool', 'boolean'))) {
34:                 return '';
35:             }
36: 
37:             return $typehint;
38:         }
39: 
40:         if ($this->rfp->isArray()) {
41:             return 'array';
42:         }
43: 
44:         /*
45:          * PHP < 5.4.1 has some strange behaviour with a typehint of self and
46:          * subclass signatures, so we risk the regexp instead
47:          */
48:         if ((version_compare(PHP_VERSION, '5.4.1') >= 0)) {
49:             try {
50:                 if ($this->rfp->getClass()) {
51:                     return $this->rfp->getClass()->getName();
52:                 }
53:             } catch (\ReflectionException $re) {
54:                 // noop
55:             }
56:         }
57: 
58:         if (preg_match('/^Parameter #[0-9]+ \[ \<(required|optional)\> (?<typehint>\S+ )?.*\$' . $this->rfp->getName() . ' .*\]$/', $this->rfp->__toString(), $typehintMatch)) {
59:             if (!empty($typehintMatch['typehint'])) {
60:                 return $typehintMatch['typehint'];
61:             }
62:         }
63: 
64:         return '';
65:     }
66: 
67:     /**
68:      * Some internal classes have funny looking definitions...
69:      */
70:     public function getName()
71:     {
72:         $name = $this->rfp->getName();
73:         if (!$name || $name == '...') {
74:             $name = 'arg' . static::$parameterCounter++;
75:         }
76: 
77:         return $name;
78:     }
79: }
80: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen