Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 0e71189

Browse files
committed
Merge pull request #17 from Miloslav/master
Fixes of PHPDoc comments and one bugfix
2 parents e4db24b + 62c6205 commit 0e71189

File tree

3 files changed

+73
-73
lines changed

3 files changed

+73
-73
lines changed

ApplicationInsights/Channel/Telemetry_Channel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getSerializedQueue()
8282
/**
8383
* Writes the item into the sending queue for subsequent processing.
8484
* @param mixed $data The telemetry item to send.
85-
* @param ApplicationInsights\Telemetry_Context $telemetryContext The context to use.
85+
* @param \ApplicationInsights\Telemetry_Context $telemetryContext The context to use.
8686
*/
8787
public function addToQueue($data, \ApplicationInsights\Telemetry_Context $telemetryContext)
8888
{

ApplicationInsights/Telemetry_Client.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,55 @@
22
namespace ApplicationInsights;
33

44
/**
5-
* Main object used for interacting with the Application Insights service.
5+
* Main object used for interacting with the Application Insights service.
66
*/
77
class Telemetry_Client
88
{
99
/**
1010
* The telemetry context this client will use
11-
* @var ApplicationInsights\Channel\Telemetry_Context
11+
* @var \ApplicationInsights\Telemetry_Context
1212
*/
1313
private $_context;
14-
14+
1515
/**
1616
* The telemetry channel this client will use
17-
* @var ApplicationInsights\Channel\Telemetry_Channel
17+
* @var \ApplicationInsights\Channel\Telemetry_Channel
1818
*/
1919
private $_channel;
20-
20+
2121
/**
2222
* Initializes a new Telemetry_Client.
23-
* @param ApplicationInsights\Telemetry_Context $context
24-
* @param ApplicationInsights\Channel\Telemetry_Channel $channel
23+
* @param \ApplicationInsights\Telemetry_Context $context
24+
* @param \ApplicationInsights\Channel\Telemetry_Channel $channel
2525
*/
2626
public function __construct(Telemetry_Context $context = NULL, Channel\Telemetry_Channel $channel = NULL)
2727
{
2828
$this->_context = ($context == NULL) ? new Telemetry_Context() : $context;
2929
$this->_channel = ($channel == NULL) ? new Channel\Telemetry_Channel() : $channel;
3030
}
31-
31+
3232
/**
33-
* Returns the Telemetry_Context this Telemetry_Client is using.
34-
* @return ApplicationInsights\Telemetry_Context
33+
* Returns the Telemetry_Context this Telemetry_Client is using.
34+
* @return \ApplicationInsights\Telemetry_Context
3535
*/
3636
public function getContext()
3737
{
3838
return $this->_context;
3939
}
40-
40+
4141
/**
42-
* Returns the Telemetry_Channel this Telemetry_Client is using.
43-
* @return ApplicationInsights\Channel\Telemetry_Channel
42+
* Returns the Telemetry_Channel this Telemetry_Client is using.
43+
* @return \ApplicationInsights\Channel\Telemetry_Channel
4444
*/
4545
public function getChannel()
4646
{
4747
return $this->_channel;
4848
}
49-
49+
5050
/**
5151
* Sends an Page_View_Data to the Application Insights service.
5252
* @param string $name The friendly name of the page view.
53-
* @param string $url The url of the page view.
53+
* @param string $url The url of the page view.
5454
* @param int duration The duration in milliseconds of the page view.
5555
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
5656
* @param array $measurements An array of name to double pairs. Use the name as the index and any double as the value.
@@ -69,45 +69,45 @@ public function trackPageView($name, $url, $duration = 0, $properties = NULL, $m
6969
{
7070
$data->setMeasurements($measurements);
7171
}
72-
72+
7373
$this->_channel->addToQueue($data, $this->_context);
7474
}
75-
75+
7676
/**
7777
* Sends an Metric_Data to the Application Insights service.
7878
* @param string $name Name of the metric.
7979
* @param double $value Value of the metric.
8080
* @param \ApplicationInsights\Channel\Data_Point_Type::Value $type The type of value being sent.
8181
* @param int $count The number of samples.
8282
* @param double $min The minimum of the samples.
83-
* @param double $max The maximum of the samples.
84-
* @param double $stdDev The standard deviation of the samples.
83+
* @param double $max The maximum of the samples.
84+
* @param double $stdDev The standard deviation of the samples.
8585
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
8686
*/
8787
public function trackMetric($name, $value, $type = NULL, $count = NULL, $min = NULL, $max = NULL, $stdDev = NULL, $properties = NULL)
8888
{
8989
$dataPoiint = new Channel\Contracts\Data_Point();
9090
$dataPoiint->setName($name);
9191
$dataPoiint->setValue($value);
92-
$dataPoiint->setKind($type == NULL ? Data_Point_Type::Aggregation : $type);
92+
$dataPoiint->setKind($type == NULL ? Channel\Contracts\Data_Point_Type::Aggregation : $type);
9393
$dataPoiint->setCount($count);
9494
$dataPoiint->setMin($min);
9595
$dataPoiint->setMax($max);
9696
$dataPoiint->setStdDev($stdDev);
97-
97+
9898
$data = new Channel\Contracts\Metric_Data();
9999
$data->setMetrics(array($dataPoiint));
100100
if ($properties != NULL)
101101
{
102102
$data->setProperties($properties);
103103
}
104-
104+
105105
$this->_channel->addToQueue($data, $this->_context);
106106
}
107-
107+
108108
/**
109109
* Sends an Event_Data to the Application Insights service.
110-
* @param string $name
110+
* @param string $name
111111
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
112112
* @param array $measurements An array of name to double pairs. Use the name as the index and any double as the value.
113113
*/
@@ -123,10 +123,10 @@ public function trackEvent($name, $properties = NULL, $measurements = NULL)
123123
{
124124
$data->setMeasurements($measurements);
125125
}
126-
126+
127127
$this->_channel->addToQueue($data, $this->_context);
128128
}
129-
129+
130130
/**
131131
* Sends an Message_Data to the Application Insights service.
132132
* @param string $message The trace message.
@@ -136,21 +136,21 @@ public function trackMessage($message, $properties = NULL)
136136
{
137137
$data = new Channel\Contracts\Message_Data();
138138
$data->setMessage($message);
139-
139+
140140
if ($properties != NULL)
141141
{
142142
$data->setProperties($properties);
143143
}
144-
144+
145145
$this->_channel->addToQueue($data, $this->_context);
146146
}
147-
147+
148148
/**
149149
* Sends a Request_Data to the Application Insights service.
150150
* @param string $name A friendly name of the request.
151151
* @param string $url The url of the request.
152152
* @param int $startTime The timestamp at which the request started.
153-
* @param int $durationInMilliseconds The duration, in milliseconds, of the request.
153+
* @param int $durationInMilliseconds The duration, in milliseconds, of the request.
154154
* @param int $httpResponseCode The response code of the request.
155155
* @param bool $isSuccessful Whether or not the request was successful.
156156
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
@@ -163,12 +163,12 @@ public function trackRequest($name, $url, $startTime, $durationInMilliseconds =
163163

164164
/**
165165
* Begin a Request_Data to the Application Insights service. This request is not sent until an @see endRequest call is made, passing this request.
166-
*
166+
*
167167
* @param string $name A friendly name of the request.
168168
* @param string $url The url of the request.
169169
* @param int $startTime The timestamp at which the request started.
170-
* @return an initialized Request_Data, which can be sent by using @see endRequest
171-
*/
170+
* @return \ApplicationInsights\Channel\Contracts\Request_Data an initialized Request_Data, which can be sent by using @see endRequest
171+
*/
172172
public function beginRequest($name, $url, $startTime )
173173
{
174174
$data = new Channel\Contracts\Request_Data();
@@ -177,41 +177,41 @@ public function beginRequest($name, $url, $startTime )
177177
$data->setName($name);
178178
$data->setUrl($url);
179179
$data->setStartTime(Channel\Contracts\Utils::returnISOStringForTime($startTime));
180-
180+
181181
return $data;
182182
}
183-
183+
184184
/**
185185
* Sends a Request_Data created by @see beginRequest to the Application Insights service.
186-
* @param int $durationInMilliseconds The duration, in milliseconds, of the request.
186+
* @param int $durationInMilliseconds The duration, in milliseconds, of the request.
187187
* @param int $httpResponseCode The response code of the request.
188188
* @param bool $isSuccessful Whether or not the request was successful.
189189
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
190190
* @param array $measurements An array of name to double pairs. Use the name as the index and any double as the value.
191-
*/
191+
*/
192192
public function endRequest( Channel\Contracts\Request_Data $request, $durationInMilliseconds = 0, $httpResponseCode = 200, $isSuccessful = true, $properties = NULL, $measurements = NULL )
193193
{
194194
$request->setResponseCode($httpResponseCode);
195195
$request->setSuccess($isSuccessful);
196-
196+
197197
$request->setDuration(Channel\Contracts\Utils::convertMillisecondsToTimeSpan($durationInMilliseconds));
198-
198+
199199
if ($properties != NULL)
200200
{
201201
$request->setProperties($properties);
202202
}
203-
203+
204204
if ($measurements != NULL)
205205
{
206206
$request->setMeasurements($measurements);
207207
}
208-
208+
209209
$this->_channel->addToQueue($request, $this->_context);
210210
}
211-
211+
212212
/**
213213
* Sends an Exception_Data to the Application Insights service.
214-
* @param Exception $ex The exception to send
214+
* @param \Exception $ex The exception to send
215215
* @param array $properties An array of name to value pairs. Use the name as the index and any string as the value.
216216
* @param array $measurements An array of name to double pairs. Use the name as the index and any double as the value.
217217
*/
@@ -225,12 +225,12 @@ public function trackException(\Exception $ex, $properties = NULL, $measurements
225225
$details->setHasFullStack(true);
226226

227227
$stackFrames = array();
228-
228+
229229
// First stack frame is in the root exception
230230
$frameCounter = 0;
231231
foreach ($ex->getTrace() as $currentFrame)
232232
{
233-
$stackFrame = new Channel\Contracts\Stack_Frame();
233+
$stackFrame = new Channel\Contracts\Stack_Frame();
234234
if (array_key_exists('class', $currentFrame) == true)
235235
{
236236
$stackFrame->setAssembly($currentFrame['class']);
@@ -247,35 +247,35 @@ public function trackException(\Exception $ex, $properties = NULL, $measurements
247247
{
248248
$stackFrame->setMethod($currentFrame['function']);
249249
}
250-
250+
251251
// Make it a string to force serialization of zero
252252
$stackFrame->setLevel(''.$frameCounter);
253-
253+
254254
array_unshift($stackFrames, $stackFrame);
255255
$frameCounter++;
256256
}
257-
257+
258258
$details->setParsedStack($stackFrames);
259-
259+
260260
$data = new Channel\Contracts\Exception_Data();
261261
$data->setHandledAt('UserCode');
262262
$data->setExceptions(array($details));
263-
263+
264264
if ($properties != NULL)
265265
{
266266
$data->setProperties($properties);
267267
}
268-
268+
269269
if ($measurements != NULL)
270270
{
271271
$data->setMeasurements($measurements);
272272
}
273-
273+
274274
$this->_channel->addToQueue($data, $this->_context);
275275
}
276-
276+
277277
/**
278-
* Flushes the underlying Telemetry_Channel queue.
278+
* Flushes the underlying Telemetry_Channel queue.
279279
*/
280280
public function flush()
281281
{

0 commit comments

Comments
 (0)