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

Commit a1fd851

Browse files
authored
Merge pull request #24 from artberri/track-dependency
Support for the TrackDependency method of Telemetry Client
2 parents 6195cf2 + 0b447d9 commit a1fd851

29 files changed

+753
-866
lines changed

ApplicationInsights/Channel/Contracts/Application.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
namespace ApplicationInsights\Channel\Contracts;
33

44
/**
5-
* Data contract class for type Application.
5+
* Data contract class for type Application.
66
*/
77
class Application
88
{
9+
use Json_Serializer;
10+
911
/**
10-
* Data array that will store all the values.
12+
* Data array that will store all the values.
1113
*/
1214
private $_data;
1315

1416
/**
15-
* Creates a new Application.
17+
* Creates a new Application.
1618
*/
1719
function __construct()
1820
{
1921
$this->_data = array();
2022
}
2123

2224
/**
23-
* Gets the ver field.
25+
* Gets the ver field.
2426
*/
2527
public function getVer()
2628
{
@@ -29,18 +31,10 @@ public function getVer()
2931
}
3032

3133
/**
32-
* Sets the ver field.
34+
* Sets the ver field.
3335
*/
3436
public function setVer($ver)
3537
{
3638
$this->_data['ai.application.ver'] = $ver;
3739
}
38-
39-
/**
40-
* Overrides JSON serialization for this class.
41-
*/
42-
public function jsonSerialize()
43-
{
44-
return Utils::removeEmptyValues($this->_data);
45-
}
4640
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
namespace ApplicationInsights\Channel\Contracts;
3+
4+
/**
5+
* Data contract class for type Event_Data.
6+
*/
7+
abstract class Base_Data implements Data_Interface
8+
{
9+
use Json_Serializer;
10+
use Version_Manager;
11+
12+
/**
13+
* Data array that will store all the values.
14+
*/
15+
protected $_data;
16+
17+
/**
18+
* Needed to properly construct the JSON envelope.
19+
*/
20+
protected $_envelopeTypeName;
21+
22+
/**
23+
* Needed to properly construct the JSON envelope.
24+
*/
25+
protected $_dataTypeName;
26+
27+
/**
28+
* Gets the envelopeTypeName field.
29+
*/
30+
public function getEnvelopeTypeName()
31+
{
32+
return $this->_envelopeTypeName;
33+
}
34+
35+
/**
36+
* Gets the dataTypeName field.
37+
*/
38+
public function getDataTypeName()
39+
{
40+
return $this->_dataTypeName;
41+
}
42+
43+
/**
44+
* Gets the properties field.
45+
*/
46+
public function getProperties()
47+
{
48+
if (array_key_exists('properties', $this->_data)) { return $this->_data['properties']; }
49+
return NULL;
50+
}
51+
52+
/**
53+
* Sets the properties field.
54+
*/
55+
public function setProperties($properties)
56+
{
57+
$this->_data['properties'] = $properties;
58+
}
59+
}

ApplicationInsights/Channel/Contracts/Data.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
namespace ApplicationInsights\Channel\Contracts;
33

44
/**
5-
* Data contract class for type Data.
5+
* Data contract class for type Data.
66
*/
77
class Data
88
{
9+
use Json_Serializer;
10+
911
/**
10-
* Data array that will store all the values.
12+
* Data array that will store all the values.
1113
*/
1214
private $_data;
1315

1416
/**
15-
* Creates a new Data.
17+
* Creates a new Data.
1618
*/
1719
function __construct()
1820
{
1921
$this->_data['baseData'] = NULL;
2022
}
2123

2224
/**
23-
* Gets the baseType field.
25+
* Gets the baseType field.
2426
*/
2527
public function getBaseType()
2628
{
@@ -29,15 +31,15 @@ public function getBaseType()
2931
}
3032

3133
/**
32-
* Sets the baseType field.
34+
* Sets the baseType field.
3335
*/
3436
public function setBaseType($baseType)
3537
{
3638
$this->_data['baseType'] = $baseType;
3739
}
3840

3941
/**
40-
* Gets the baseData field.
42+
* Gets the baseData field.
4143
*/
4244
public function getBaseData()
4345
{
@@ -46,18 +48,10 @@ public function getBaseData()
4648
}
4749

4850
/**
49-
* Sets the baseData field.
51+
* Sets the baseData field.
5052
*/
5153
public function setBaseData($baseData)
5254
{
5355
$this->_data['baseData'] = $baseData;
5456
}
55-
56-
/**
57-
* Overrides JSON serialization for this class.
58-
*/
59-
public function jsonSerialize()
60-
{
61-
return Utils::removeEmptyValues($this->_data);
62-
}
6357
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
namespace ApplicationInsights\Channel\Contracts;
3+
4+
/**
5+
* Interface class for XXXXX_Data.
6+
*/
7+
interface Data_Interface
8+
{
9+
/**
10+
* Gets the envelopeTypeName field.
11+
*/
12+
public function getEnvelopeTypeName();
13+
14+
/**
15+
* Gets the dataTypeName field.
16+
*/
17+
public function getDataTypeName();
18+
19+
/**
20+
* Gets the ver field.
21+
*/
22+
public function getVer();
23+
24+
/**
25+
* Sets the ver field.
26+
*/
27+
public function setVer($ver);
28+
29+
/**
30+
* Gets the properties field.
31+
*/
32+
public function getProperties();
33+
34+
/**
35+
* Sets the properties field.
36+
*/
37+
public function setProperties($properties);
38+
39+
/**
40+
* JSON serialization for this class.
41+
*/
42+
public function jsonSerialize();
43+
}

ApplicationInsights/Channel/Contracts/Data_Point.php

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
namespace ApplicationInsights\Channel\Contracts;
33

44
/**
5-
* Data contract class for type Data_Point.
5+
* Data contract class for type Data_Point.
66
*/
77
class Data_Point
88
{
9+
use Json_Serializer;
10+
911
/**
10-
* Data array that will store all the values.
12+
* Data array that will store all the values.
1113
*/
1214
private $_data;
1315

1416
/**
15-
* Creates a new DataPoint.
17+
* Creates a new DataPoint.
1618
*/
1719
function __construct()
1820
{
@@ -22,7 +24,7 @@ function __construct()
2224
}
2325

2426
/**
25-
* Gets the name field.
27+
* Gets the name field.
2628
*/
2729
public function getName()
2830
{
@@ -31,15 +33,15 @@ public function getName()
3133
}
3234

3335
/**
34-
* Sets the name field.
36+
* Sets the name field.
3537
*/
3638
public function setName($name)
3739
{
3840
$this->_data['name'] = $name;
3941
}
4042

4143
/**
42-
* Gets the kind field.
44+
* Gets the kind field.
4345
*/
4446
public function getKind()
4547
{
@@ -48,15 +50,15 @@ public function getKind()
4850
}
4951

5052
/**
51-
* Sets the kind field.
53+
* Sets the kind field.
5254
*/
5355
public function setKind($kind)
5456
{
5557
$this->_data['kind'] = $kind;
5658
}
5759

5860
/**
59-
* Gets the value field.
61+
* Gets the value field.
6062
*/
6163
public function getValue()
6264
{
@@ -65,15 +67,15 @@ public function getValue()
6567
}
6668

6769
/**
68-
* Sets the value field.
70+
* Sets the value field.
6971
*/
7072
public function setValue($value)
7173
{
7274
$this->_data['value'] = $value;
7375
}
7476

7577
/**
76-
* Gets the count field.
78+
* Gets the count field.
7779
*/
7880
public function getCount()
7981
{
@@ -82,15 +84,15 @@ public function getCount()
8284
}
8385

8486
/**
85-
* Sets the count field.
87+
* Sets the count field.
8688
*/
8789
public function setCount($count)
8890
{
8991
$this->_data['count'] = $count;
9092
}
9193

9294
/**
93-
* Gets the min field.
95+
* Gets the min field.
9496
*/
9597
public function getMin()
9698
{
@@ -99,15 +101,15 @@ public function getMin()
99101
}
100102

101103
/**
102-
* Sets the min field.
104+
* Sets the min field.
103105
*/
104106
public function setMin($min)
105107
{
106108
$this->_data['min'] = $min;
107109
}
108110

109111
/**
110-
* Gets the max field.
112+
* Gets the max field.
111113
*/
112114
public function getMax()
113115
{
@@ -116,15 +118,15 @@ public function getMax()
116118
}
117119

118120
/**
119-
* Sets the max field.
121+
* Sets the max field.
120122
*/
121123
public function setMax($max)
122124
{
123125
$this->_data['max'] = $max;
124126
}
125127

126128
/**
127-
* Gets the stdDev field.
129+
* Gets the stdDev field.
128130
*/
129131
public function getStdDev()
130132
{
@@ -133,18 +135,10 @@ public function getStdDev()
133135
}
134136

135137
/**
136-
* Sets the stdDev field.
138+
* Sets the stdDev field.
137139
*/
138140
public function setStdDev($stdDev)
139141
{
140142
$this->_data['stdDev'] = $stdDev;
141143
}
142-
143-
/**
144-
* Overrides JSON serialization for this class.
145-
*/
146-
public function jsonSerialize()
147-
{
148-
return Utils::removeEmptyValues($this->_data);
149-
}
150144
}

0 commit comments

Comments
 (0)