-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractMasterFormatter.php
More file actions
42 lines (36 loc) · 992 Bytes
/
AbstractMasterFormatter.php
File metadata and controls
42 lines (36 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace App\Models\pjsk\PackFormatters;
abstract class AbstractMasterFormatter
{
public static $FORMATTER = [];
private $__headers__;
function __construct()
{
$this->__headers__ = collect();
$this->pre_read_heads();
}
function pre_read_heads()
{
foreach (static::$FORMATTER as $key => $value) {
$this->__headers__[$key] = self::read_head($value);
}
}
function headers()
{
return $this->__headers__;
}
static function read_head($head_data)
{
$fid = $head_data[0];
$fn = $head_data[1];
if (isset($head_data[2])) {
if (is_array($head_data[2])) {
$_formatter = [SekaiPackHelper::getFormatterByName($head_data[2][0])];
} else {
$_formatter = SekaiPackHelper::getFormatterByName($head_data[2]);
}
return [$fid, $fn, $_formatter];
}
return [$fid, $fn];
}
}