Completed
Push — master ( a7ba40...b3dcaf )
by Tomáš
06:44
created

SingleExportBase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 5 1
A getWithObject() 0 4 1
1
<?php
2
3
4
namespace TournamentGenerator\Export;
5
6
use TournamentGenerator\Interfaces\WithId;
7
8
/**
9
 * Class SingleExportBase
10
 *
11
 * Base class for all "Single" exporters = exporting only one specific class (Team, Game) and not a hierarchy class (Tournament, Category, Round, Group).
12
 *
13
 * @package TournamentGenerator\Export
14
 * @author Tomáš Vojík <[email protected]>
15
 * @since 0.5
16
 */
17
abstract class SingleExportBase extends ExportBase implements SingleExport
18
{
19
20
	/**
21
	 * Finish the export query -> get the result
22
	 *
23
	 * @return array The query result
24
	 */
25
	public function get() : array {
26
		$data = $this->getBasic();
27
		$this->applyModifiers($data);
28
		unset($data['object']);
29
		return $data;
30
	}
31
32
	/**
33
	 * Finish the export query -> get the result including an object reference
34
	 *
35
	 * @return array
36
	 */
37
	public function getWithObject() : array {
38
		$data = $this->getBasic();
39
		$this->applyModifiers($data);
40
		return $data;
41
	}
42
43
}