| Conditions | 2 |
| Paths | 2 |
| Total Lines | 52 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 25 | public function getHelperProperties(MediaInterface $media, $format, $options = []) |
||
| 26 | { |
||
| 27 | // documentation : http://vimeo.com/api/docs/moogaloop |
||
| 28 | $defaults = [ |
||
| 29 | // (optional) Flash Player version of app. Defaults to 9 .NEW! |
||
| 30 | // 10 - New Moogaloop. 9 - Old Moogaloop without newest features. |
||
| 31 | 'fp_version' => 10, |
||
| 32 | |||
| 33 | // (optional) Enable fullscreen capability. Defaults to true. |
||
| 34 | 'fullscreen' => true, |
||
| 35 | |||
| 36 | // (optional) Show the byline on the video. Defaults to true. |
||
| 37 | 'title' => true, |
||
| 38 | |||
| 39 | // (optional) Show the title on the video. Defaults to true. |
||
| 40 | 'byline' => 0, |
||
| 41 | |||
| 42 | // (optional) Show the user's portrait on the video. Defaults to true. |
||
| 43 | 'portrait' => true, |
||
| 44 | |||
| 45 | // (optional) Specify the color of the video controls. |
||
| 46 | 'color' => null, |
||
| 47 | |||
| 48 | // (optional) Set to 1 to disable HD. |
||
| 49 | 'hd_off' => 0, |
||
| 50 | |||
| 51 | // Set to 1 to enable the Javascript API. |
||
| 52 | 'js_api' => null, |
||
| 53 | |||
| 54 | // (optional) JS function called when the player loads. Defaults to vimeo_player_loaded. |
||
| 55 | 'js_onLoad' => 0, |
||
| 56 | |||
| 57 | // Unique id that is passed into all player events as the ending parameter. |
||
| 58 | 'js_swf_id' => uniqid('vimeo_player_'), |
||
| 59 | ]; |
||
| 60 | |||
| 61 | $player_parameters = array_merge($defaults, $options['player_parameters'] ?? []); |
||
| 62 | |||
| 63 | $box = $this->getBoxHelperProperties($media, $format, $options); |
||
| 64 | |||
| 65 | $params = [ |
||
| 66 | 'src' => http_build_query($player_parameters), |
||
| 67 | 'id' => $player_parameters['js_swf_id'], |
||
| 68 | 'frameborder' => $options['frameborder'] ?? 0, |
||
| 69 | 'width' => $box->getWidth(), |
||
| 70 | 'height' => $box->getHeight(), |
||
| 71 | 'class' => $options['class'] ?? '', |
||
| 72 | 'allow_fullscreen' => isset($options['allowfullscreen']) ? true : false, |
||
| 73 | ]; |
||
| 74 | |||
| 75 | return $params; |
||
| 76 | } |
||
| 77 | |||
| 171 |