1: <?php
2: namespace NGS\Patterns;
3:
4: require_once(__DIR__.'/../Client/RestHttp.php');
5: require_once(__DIR__.'/../Client/StandardProxy.php');
6: require_once(__DIR__.'/Specification.php');
7: require_once(__DIR__.'/CubeBuilder.php');
8:
9: use \NGS\Client\RestHttp;
10: use \NGS\Client\StandardProxy;
11: use \NGS\Patterns\Specification;
12: use \NGS\Patterns\CubeBuilder;
13:
14: abstract class OlapCube
15: {
16: 17: 18:
19: protected $restHttp;
20:
21: 22: 23:
24: public abstract function getDimensions();
25:
26: 27: 28:
29: public abstract function getFacts();
30:
31: 32: 33: 34: 35:
36: public function __construct(RestHttp $restHttp = null)
37: {
38: if ($restHttp === null) {
39: $restHttp = RestHttp::instance();
40: }
41: $this->restHttp = $restHttp;
42: }
43:
44: public function builder()
45: {
46: return new CubeBuilder($this);
47: }
48:
49: 50: 51: 52: 53:
54: public function analyze(
55: array $dimensions,
56: array $facts = array(),
57: array $order = array(),
58: Specification $specification = null)
59: {
60: $proxy = new StandardProxy($this->restHttp);
61: return $specification === null
62: ? $proxy->olapCube($this, $dimensions, $facts, $order)
63: : $proxy->olapCubeWithSpecification($this, $specification, $dimensions, $facts, $order);
64: }
65: }
66: