1 <?php
defined('SYSPATH') or die('No direct script access.');
3 * Class method parameter documentation generator.
5 * @package Kohana/Userguide
8 * @copyright (c) 2008-2013 Kohana Team
9 * @license http://kohanaframework.org/license
11 class Kohana_Kodoc_Method_Param
extends Kodoc
{
14 * @var object ReflectionParameter for this property
19 * @var string name of this var
24 * @var string variable type, retrieved from the comment
29 * @var string default value of this param
34 * @var string description of this parameter
39 * @var boolean is the parameter passed by reference?
41 public $reference = FALSE;
44 * @var boolean is the parameter optional?
46 public $optional = FALSE;
48 public function __construct($method, $param)
50 $this->param
= new ReflectionParameter($method, $param);
52 $this->name
= $this->param
->name
;
54 if ($this->param
->isDefaultValueAvailable())
56 $this->default = Debug
::dump($this->param
->getDefaultValue());
59 if ($this->param
->isPassedByReference())
61 $this->reference
= TRUE;
64 if ($this->param
->isOptional())
66 $this->optional
= TRUE;
70 public function __toString()
76 $display .= '<small>'.$this->type
.'</small> ';
81 $display .= '<small><abbr title="passed by reference">&</abbr></small> ';
84 if ($this->description
)
86 $display .= '<span class="param" title="'.preg_replace('/\s+/', ' ', $this->description
).'">$'.$this->name
.'</span> ';
90 $display .= '$'.$this->name
.' ';
95 $display .= '<small>= '.$this->default.'</small> ';
101 } // End Kodoc_Method_Param