1 | <?php |
||
14 | class FooGallery_Pro_Video_oEmbed extends FooGallery_Pro_Video_Base { |
||
15 | |||
16 | /** |
||
17 | * Takes a URL and attempts to return a result generated from its oEmbed data. |
||
18 | * |
||
19 | * @param string $url The url to fetch. |
||
20 | * |
||
21 | * @return array( |
||
22 | * "mode" => "embed", |
||
23 | * "videos" => array( |
||
24 | * array( |
||
25 | * "provider" => string, |
||
26 | * "id" => string, |
||
27 | * "url" => string, |
||
28 | * "thumbnail" => string, |
||
29 | * "title" => string, |
||
30 | * "description" => string, |
||
31 | * "html" => string |
||
32 | * ) |
||
33 | * ) |
||
34 | * ) |
||
35 | * @return array( |
||
36 | * "mode" => "error", |
||
37 | * "title" => string, |
||
38 | * "message" => string |
||
39 | * ) |
||
40 | */ |
||
41 | function fetch( $url ) { |
||
75 | |||
76 | /** |
||
77 | * Gets a unique ID for the supplied provider and url. |
||
78 | * |
||
79 | * @param string $provider The provider for the current URL. |
||
80 | * @param string $url The URL to the oEmbed video. |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | private function get_id( $provider, $url ) { |
||
94 | } |
||
95 | } |
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.