1 | <?php |
||
8 | class Client |
||
9 | { |
||
10 | protected $stream; |
||
11 | protected $namespace; |
||
12 | protected $throw_exceptions; |
||
13 | |||
14 | /** |
||
15 | * Creates an instance of the Carbon Client |
||
16 | * |
||
17 | * @param resource $stream A php stream that knows how to talk to Carbon. |
||
18 | */ |
||
19 | public function __construct($stream) |
||
28 | |||
29 | /** |
||
30 | * Controls whether failed calls to Carbon will throw an Exception. |
||
31 | * |
||
32 | * @see send() |
||
33 | * |
||
34 | * @param boolean $throw |
||
35 | * |
||
36 | * @return self |
||
37 | */ |
||
38 | public function throwExceptions($throw = true) |
||
44 | |||
45 | /** |
||
46 | * Sets the namespace used to prepend metric's paths |
||
47 | * |
||
48 | * @param string $namespace |
||
49 | * |
||
50 | * @return self |
||
51 | */ |
||
52 | public function setNamespace($namespace) |
||
58 | |||
59 | /** |
||
60 | * Returns the current namespace. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getNamespace() |
||
68 | |||
69 | /** |
||
70 | * Sends a metric to Carbon. |
||
71 | * |
||
72 | * @see http://graphite.readthedocs.org/en/latest/feeding-carbon.html |
||
73 | * |
||
74 | * @param string $path Metric Path |
||
75 | * @param int|float $value Metric Value |
||
76 | * @param int|null $timestamp Metric Timestamp |
||
77 | * |
||
78 | * @throws ErrorException If $this->throw_exceptions is true |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function send($path, $value, $timestamp = null) |
||
121 | |||
122 | /** |
||
123 | * Sanitizes a path string |
||
124 | * |
||
125 | * Carbon stores metrics using dot delimited paths |
||
126 | * {@link http://graphite.readthedocs.org/en/latest/feeding-carbon.html} |
||
127 | * |
||
128 | * Replaces: |
||
129 | * - whitespace with undercores |
||
130 | * - consecutive dots with a single dot. |
||
131 | * |
||
132 | * Removes: |
||
133 | * - the wildcard character (used by graphite) |
||
134 | * - leading and trailing dots |
||
135 | * |
||
136 | * @param string $path the path string to sanitize |
||
|
|||
137 | * |
||
138 | * @return string The sanitized path string or an empty one. |
||
139 | */ |
||
140 | public function sanitizePath($string) |
||
160 | |||
161 | /** |
||
162 | * Closes the stream when the object is destructed |
||
163 | */ |
||
164 | public function __destruct() |
||
170 | } |
||
171 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.