1 | <?php |
||
10 | class WordPress_GitHub_Sync_Blob { |
||
11 | |||
12 | /** |
||
13 | * Raw blob data. |
||
14 | * |
||
15 | * @var stdClass |
||
16 | */ |
||
17 | protected $data; |
||
18 | |||
19 | /** |
||
20 | * Complete blob content. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $content; |
||
25 | |||
26 | /** |
||
27 | * Blob sha. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $sha; |
||
32 | |||
33 | /** |
||
34 | * Blob path. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $path; |
||
39 | |||
40 | /** |
||
41 | * Whether the blob has frontmatter. |
||
42 | * |
||
43 | * @var boolean |
||
44 | */ |
||
45 | protected $frontmatter = false; |
||
46 | |||
47 | /** |
||
48 | * Instantiates a new Blob object. |
||
49 | * |
||
50 | * @param stdClass $data Raw blob data. |
||
51 | */ |
||
52 | 10 | public function __construct( stdClass $data ) { |
|
57 | |||
58 | /** |
||
59 | * Returns the raw blob content. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | 8 | public function content() { |
|
66 | |||
67 | /** |
||
68 | * Set's the blob's content. |
||
69 | * |
||
70 | * @param string $content Raw blob content. |
||
71 | * @param bool $base64 Whether the content is base64 encoded. |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | 10 | public function set_content( $content, $base64 = false ) { |
|
84 | /** |
||
85 | * Returns the blob sha. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | 8 | public function sha() { |
|
92 | |||
93 | /** |
||
94 | * Return's the blob path. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 8 | public function path() { |
|
101 | |||
102 | /** |
||
103 | * Whether the blob has frontmatter. |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | 2 | public function has_frontmatter() { |
|
110 | |||
111 | /** |
||
112 | * Returns the formatted/filtered blob content used for import. |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | 2 | public function content_import() { |
|
134 | |||
135 | /** |
||
136 | * Returns the blob meta. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | 2 | public function meta() { |
|
156 | |||
157 | /** |
||
158 | * Formats the blob into an API call body. |
||
159 | * |
||
160 | * @return stdClass |
||
161 | */ |
||
162 | 5 | public function to_body() { |
|
178 | |||
179 | /** |
||
180 | * Interprets the blob's data into properties. |
||
181 | */ |
||
182 | 10 | protected function interpret_data() { |
|
191 | } |
||
192 |