1 | <?php |
||
8 | abstract class FileTextExtractor extends Object |
||
|
|||
9 | { |
||
10 | /** |
||
11 | * Set priority from 0-100. |
||
12 | * The highest priority extractor for a given content type will be selected. |
||
13 | * |
||
14 | * @config |
||
15 | * @var integer |
||
16 | */ |
||
17 | private static $priority = 50; |
||
18 | |||
19 | /** |
||
20 | * Cache of extractor class names, sorted by priority |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected static $sorted_extractor_classes = null; |
||
25 | |||
26 | /** |
||
27 | * Gets the list of prioritised extractor classes |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | protected static function get_extractor_classes() |
||
51 | |||
52 | /** |
||
53 | * Get the text file extractor for the given class |
||
54 | * |
||
55 | * @param string $class |
||
56 | * @return FileTextExtractor |
||
57 | */ |
||
58 | protected static function get_extractor($class) |
||
62 | |||
63 | /** |
||
64 | * Attempt to detect mime type for given file |
||
65 | * |
||
66 | * @param string $path |
||
67 | * @return string Mime type if found |
||
68 | */ |
||
69 | protected static function get_mime($path) |
||
75 | |||
76 | /** |
||
77 | * @param string $path |
||
78 | * @return FileTextExtractor|null |
||
79 | */ |
||
80 | public static function for_file($path) |
||
107 | |||
108 | /** |
||
109 | * Checks if the extractor is supported on the current environment, |
||
110 | * for example if the correct binaries or libraries are available. |
||
111 | * |
||
112 | * @return boolean |
||
113 | */ |
||
114 | abstract public function isAvailable(); |
||
115 | |||
116 | /** |
||
117 | * Determine if this extractor supports the given extension. |
||
118 | * If support is determined by mime/type only, then this should return false. |
||
119 | * |
||
120 | * @param string $extension |
||
121 | * @return boolean |
||
122 | */ |
||
123 | abstract public function supportsExtension($extension); |
||
124 | |||
125 | /** |
||
126 | * Determine if this extractor suports the given mime type. |
||
127 | * Will only be called if supportsExtension returns false. |
||
128 | * |
||
129 | * @param string $mime |
||
130 | * @return boolean |
||
131 | */ |
||
132 | abstract public function supportsMime($mime); |
||
133 | |||
134 | /** |
||
135 | * Given a file path, extract the contents as text. |
||
136 | * |
||
137 | * @param string $path |
||
138 | * @return string |
||
139 | */ |
||
140 | abstract public function getContent($path); |
||
141 | } |
||
142 | |||
146 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.