1 | <?php |
||
12 | class Quran |
||
13 | { |
||
14 | /** |
||
15 | * Quran application version. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | const VERSION = 'v0.5.0'; |
||
20 | |||
21 | private $config; |
||
22 | |||
23 | private $translations = ['ar']; |
||
24 | |||
25 | private $source; |
||
26 | |||
27 | 78 | public function __construct(array $config = array()) |
|
34 | |||
35 | /** |
||
36 | * Set quran source either XML, Sql. |
||
37 | * |
||
38 | * @param \FaizShukri\Quran\Repositories\Source\SourceInterface $source |
||
39 | */ |
||
40 | 78 | public function setSource(SourceInterface $source) |
|
46 | |||
47 | /** |
||
48 | * Get source variable. |
||
49 | * |
||
50 | * @return \FaizShukri\Quran\Repositories\Source\SourceInterface $source |
||
51 | */ |
||
52 | public function getSource() |
||
56 | |||
57 | /** |
||
58 | * Set translations to be used. |
||
59 | * |
||
60 | * @param array|string $translations |
||
61 | * |
||
62 | * @return self |
||
63 | */ |
||
64 | 30 | public function translation($translations) |
|
78 | |||
79 | /** |
||
80 | * Get ayah. |
||
81 | * |
||
82 | * @param string $args String of supported format of ayah |
||
83 | * |
||
84 | * @return string|array Ayah |
||
85 | * |
||
86 | * @throws AyahNotProvided |
||
87 | * @throws WrongArgument |
||
88 | */ |
||
89 | 66 | public function get($args) |
|
118 | |||
119 | /** |
||
120 | * Get surah information. |
||
121 | * |
||
122 | * @return object Chapter information of a chapter |
||
123 | */ |
||
124 | 6 | public function surah($surah = null) |
|
128 | |||
129 | /** |
||
130 | * Parse the ayah requested of a certain surah. The format of ayah will |
||
131 | * be translated into an array or ayah. |
||
132 | * |
||
133 | * @param string $surah |
||
134 | * |
||
135 | * @return array Array of ayah |
||
136 | */ |
||
137 | 60 | private function parseSurah($surah) |
|
162 | |||
163 | /** |
||
164 | * Sort array in ascending by it's key. |
||
165 | * |
||
166 | * @param array $arr |
||
167 | * |
||
168 | * @return array |
||
169 | */ |
||
170 | 24 | private function sortArray(array $arr) |
|
176 | |||
177 | /** |
||
178 | * Reduce the array level by remove unnecessary parent. |
||
179 | * |
||
180 | * @param array $array |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | 39 | private function minimize(array $array) |
|
201 | |||
202 | /** |
||
203 | * Get the Quran Application version. |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | 3 | public static function version() |
|
211 | } |
||
212 |