1 | <?php |
||
14 | class FooGallery_Pro_Video_Self_Hosted extends FooGallery_Pro_Video_Base { |
||
15 | |||
16 | // region Properties |
||
17 | |||
18 | /** |
||
19 | * The regular expression used to match a self-hosted video URL. |
||
20 | * @var string |
||
21 | */ |
||
22 | public $regex_pattern; |
||
23 | /** |
||
24 | * The array of supported MIME types for self-hosted videos. |
||
25 | * @var array |
||
26 | */ |
||
27 | public $mime_types; |
||
28 | |||
29 | // endregion |
||
30 | |||
31 | function __construct() { |
||
35 | |||
36 | /** |
||
37 | * Takes a URL and checks if this class handles it. |
||
38 | * |
||
39 | * @param string $url The URL to check. |
||
40 | * @param array &$matches Optional. If matches is provided, it is passed to the `preg_match` call used to check the URL. |
||
41 | * @return int Returns 1 if the URL is handled, 0 if it is not, or FALSE if an error occurred. |
||
42 | */ |
||
43 | function handles($url, &$matches = array()){ |
||
46 | |||
47 | /** |
||
48 | * Takes the supplied URL and fetches a self-hosted video object. |
||
49 | * |
||
50 | * @param string $url The URL to retrieve the video object for. |
||
51 | * |
||
52 | * @return array( |
||
53 | * "mode" => "self-hosted", |
||
54 | * "id" => string, |
||
55 | * "thumbnail" => string, |
||
56 | * "title" => string, |
||
57 | * "description" => string, |
||
58 | * "urls" => array( |
||
59 | * "mp4" => string, |
||
60 | * "ogg" => string, |
||
61 | * "webm" => string |
||
62 | * ) |
||
63 | * ) |
||
64 | * @return array( |
||
65 | * "mode" => "error", |
||
66 | * "title" => string, |
||
67 | * "message" => string |
||
68 | * ) |
||
69 | */ |
||
70 | function fetch($url){ |
||
98 | |||
99 | } |
||
100 | |||
101 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.