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 | * content mime type. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $mimetype; |
||
32 | |||
33 | /** |
||
34 | * content file extention. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $file_extension; |
||
39 | |||
40 | /** |
||
41 | * Blob sha. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $sha; |
||
46 | |||
47 | /** |
||
48 | * Blob path. |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $path; |
||
53 | |||
54 | /** |
||
55 | * Whether the blob has frontmatter. |
||
56 | * |
||
57 | * @var boolean |
||
58 | */ |
||
59 | protected $frontmatter = false; |
||
60 | |||
61 | /** |
||
62 | * Instantiates a new Blob object. |
||
63 | * |
||
64 | * @param stdClass $data Raw blob data. |
||
65 | */ |
||
66 | public function __construct( stdClass $data ) { |
||
71 | |||
72 | public function mimetype() { |
||
85 | |||
86 | public function file_extension() { |
||
89 | |||
90 | /** |
||
91 | * Returns the raw blob content. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function content() { |
||
98 | |||
99 | /** |
||
100 | * Set's the blob's content. |
||
101 | * |
||
102 | * @param string $content Raw blob content. |
||
103 | * @param bool $base64 Whether the content is base64 encoded. |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | public function set_content( $content, $base64 = false ) { |
||
116 | |||
117 | /** |
||
118 | * Returns the blob sha. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function sha() { |
||
125 | |||
126 | /** |
||
127 | * Return's the blob path. |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function path() { |
||
134 | |||
135 | /** |
||
136 | * Whether the blob has frontmatter. |
||
137 | * |
||
138 | * @return bool |
||
139 | */ |
||
140 | public function has_frontmatter() { |
||
143 | |||
144 | /** |
||
145 | * Returns the formatted/filtered blob content used for import. |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | public function content_import() { |
||
167 | |||
168 | /** |
||
169 | * Returns the blob meta. |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | public function meta() { |
||
189 | |||
190 | /** |
||
191 | * Formats the blob into an API call body. |
||
192 | * |
||
193 | * @return stdClass |
||
194 | */ |
||
195 | public function to_body() { |
||
211 | |||
212 | /** |
||
213 | * Interprets the blob's data into properties. |
||
214 | */ |
||
215 | protected function interpret_data() { |
||
226 | } |
||
227 |