Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
41 | 10 | private static function objectValidation($hookContent) |
|
42 | { |
||
43 | 10 | $hookContent = json_decode($hookContent); |
|
44 | |||
45 | 10 | if (!isset($hookContent->object_kind)) { |
|
46 | 2 | throw new Exception('Object kind not found in the hook data'); |
|
47 | } |
||
48 | |||
49 | 8 | if (!in_array($hookContent->object_kind, ['push', 'build'])) { |
|
50 | 2 | throw new Exception('Unknown Object kind from the hook'); |
|
51 | } |
||
52 | |||
53 | 6 | return $hookContent; |
|
54 | } |
||
55 | } |
||
56 |