# Source of file Debug.php

Size: 4,955 Bytes - Last Modified: 2016-08-28T19:38:31+00:00

## /Users/dshafik/src/akamai-open/edgegrid-auth-php/src/Handler/Debug.php

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
Covered by 15 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInvalidStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

51 52
Covered by 15 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInvalidStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

53
Covered by 2 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInvalidStringResource

54
Covered by 2 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInvalidStringResource

55
Covered by 1 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInvalidStringResource

56 57 58 59
Covered by 14 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

60
Covered by 3 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle

61 62 63
Covered by 14 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

64
Covered by 14 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStringResource
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

65 66 67 68 69 70 71 72 73 74 75
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

76 77 78 79 80 81
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

82 83
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

84 85 86 87 88 89 90 91
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

92 93
Covered by 10 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

94
Covered by 10 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

95
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

96
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

97
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

98
Covered by 5 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail

99
Covered by 4 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

100 101
Covered by 5 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail

102 103 104
Covered by 2 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

105 106 107
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

108
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

109 110
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

111
Covered by 4 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

112
Covered by 4 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

113
Covered by 1 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

114 115 116
Covered by 4 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

117
Covered by 4 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages

118 119 120 121
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

122
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

123 124
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

125
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

126
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

127
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

128 129 130 131
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

132
Covered by 7 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

133 134 135
Covered by 10 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody

136
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

137 138
Covered by 3 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

139
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

140 141
Covered by 13 test(s):

- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testStaticDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugSingle
- Akamai\Open\EdgeGrid\Tests\Handler\AuthenticationTest::testInstanceDebugOptionSingle
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testStaticDebug
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testInstanceOverrideStream
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugMessages
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoDetail
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testResponseNoJsonBody
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testDebugResponseExceptionNoCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithCode
- Akamai\Open\EdgeGrid\Tests\Handler\DebugTest::testVerboseResponseExceptionWithBody

142 143 144

    <?php

    /**

     * Akamai {OPEN} EdgeGrid Auth for PHP

     *

     * Provides Request Signing as per

     * {@see https://developer.akamai.com/introduction/Client_Auth.html}

     * as GuzzleHttp a Middleware Handlers

     *

     * @author Davey Shafik <dshafik@akamai.com>

     * @copyright Copyright 2015 Akamai Technologies, Inc. All rights reserved.

     * @license Apache 2.0

     * @link https://github.com/akamai-open/edgegrid-auth-php

     * @link https://developer.akamai.com

     * @link https://developer.akamai.com/introduction/Client_Auth.html

     */

    namespace Akamai\Open\EdgeGrid\Handler;

    use Akamai\Open\EdgeGrid\Exception\HandlerException\IOException;

    /**

     * Debug Response Guzzle Middleware Handler

     *

     * @package Akamai {OPEN} EdgeGrid Auth

     */

    class Debug

    {

        protected static $messages = [

            403 => [

                "This indicates a problem with authorization.\n",

                "Please ensure that the credentials you created for this script\n",

                "have the necessary permissions in the Luna portal.\n",

            ],

            400 => [

                "This indicates a problem with authentication or headers.",

                "Please ensure that the .edgerc file is formatted correctly.",

                "If you still have issues, please use gen_edgerc.php to generate the credentials",

            ],

            401 => 400,

            404 => [

                "This means that the page does not exist as requested.\n",

                "Please ensure that the URL you're calling is correctly formatted\n",

                "or look at other examples to make sure yours matches.\n",

            ]

        ];

        protected $fp;

        public function __construct($resource = null)

        {

            $fp = $resource;

            if (!is_resource($fp) && $fp !== null) {

                $fp = @fopen($fp, 'a+');

                if (!$fp) {

                    throw new IOException("Unable to use resource: " . (string) $resource);

                }

            }

            if ($fp === null) {

                $fp = fopen('php://stderr', 'a');

            }

            $this->fp = $fp;

        }

        /**

         * Handle the request/response

         *

         * @param callable $handler

         * @return \Closure

         */

        public function __invoke(callable $handler)

        {

            $colors = [

                'red' => "",

                'yellow' => "",

                'cyan' => "",

                'reset' => "",

            ];

            if (PHP_SAPI == 'cli') {

                $colors = [

                    'red' => "\x1b[31;01m",

                    'yellow' => "\x1b[33;01m",

                    'cyan' => "\x1b[36;01m",

                    'reset' => "\x1b[39;49;00m",

                ];

            }

            return function (\Psr\Http\Message\RequestInterface $request, array $config) use ($handler, $colors) {

                return $handler($request, $config)->then(

                    function (\Psr\Http\Message\ResponseInterface $response) use ($colors, $request) {

                        $statusCode = $response->getStatusCode();

                        if ($statusCode > 399 && $statusCode < 600) {

                            $body = trim($response->getBody());

                            $result = json_decode($body);

                            if ($result !== null) {

                                if (isset($result->detail)) {

                                    $detail = $result->detail;

                                } else {

                                    $detail = json_encode($result, JSON_PRETTY_PRINT);

                                }

                            } else {

                                $detail = (!empty(trim($body))) ? $body : "No response body returned";

                            }

                            $out = [];

                            $out[] = "{$colors['red']}===> [ERROR] Call to %s failed with a %s result";

                            if (isset(self::$messages[$statusCode])) {

                                $message = self::$messages[$statusCode];

                                if (is_int($message) && isset(self::$messages[$message])) {

                                    $message = self::$messages[$message];

                                }

                                foreach ($message as $line) {

                                    $out[] = "===> [ERROR] " . $line;

                                }

                            }

                            $out[] = "===> [ERROR] Problem details:";

                            $out[] = $detail;

                            $out = sprintf(

                                implode("\n", $out),

                                $request->getUri()->getPath(),

                                $response->getStatusCode() . ' ' . $response->getReasonPhrase(),

                                $detail

                            );

                            fputs($this->fp, $out);

                            fputs($this->fp, "{$colors['reset']}\n");

                        }

                        return $response;

                    },

                    function (\Exception $reason) {

                        return new \GuzzleHttp\Promise\RejectedPromise($reason);

                    }

                );

            };

        }

    }