Ajax   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createResponse() 0 4 1
1
<?php
2
3
/**
4
 * @package Cadmium\Framework\Ajax
5
 * @author Anton Romanov
6
 * @copyright Copyright (c) 2015-2017, Anton Romanov
7
 * @link http://cadmium-cms.com
8
 */
9
10
namespace {
11
12
	abstract class Ajax {
13
14
		/**
15
		 * Create a new response object
16
		 */
17
18
		public static function createResponse(array $data = []) : Ajax\Response {
19
20
			return new Ajax\Response($data);
21
		}
22
23
		/**
24
		 * Check if a given variable is a response object
25
		 */
26
27
		public static function isResponse($object) : bool {
28
29
			return ($object instanceof Ajax\Response);
30
		}
31
32
		/**
33
		 * Output JSON data contained in a given response object
34
		 */
35
36
		public static function output(Ajax\Response $response) {
37
38
			JSON::output($response->getData());
39
		}
40
	}
41
}
42