| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| Code Lines | 24 |
| 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://www.dailymotion.com/en/doc/api/player |
||
| 28 | |||
| 29 | $defaults = [ |
||
| 30 | // Values: 0 or 1. Default is 0. Determines if the player loads related videos when |
||
| 31 | // the current video begins playback. |
||
| 32 | 'related' => 0, |
||
| 33 | |||
| 34 | // Values: 0 or 1. Default is 1. Determines if the player allows explicit content to |
||
| 35 | // be played. This parameter may be added to embed code by platforms which do not |
||
| 36 | // want explicit content to be posted by their users. |
||
| 37 | 'explicit' => 0, |
||
| 38 | |||
| 39 | // Values: 0 or 1. Default is 0. Determines if the video will begin playing |
||
| 40 | // automatically when the player loads. |
||
| 41 | 'autoPlay' => 0, |
||
| 42 | |||
| 43 | // Values: 0 or 1. Default is 0. Determines if the video will begin muted. |
||
| 44 | 'autoMute' => 0, |
||
| 45 | |||
| 46 | // Values: 0 or 1. Default is 0. Determines if the video will unmuted on mouse over. |
||
| 47 | // Of course it works only if the player is on automute=1. |
||
| 48 | 'unmuteOnMouseOver' => 0, |
||
| 49 | |||
| 50 | // Values: a number of seconds. Default is 0. Determines if the video will begin |
||
| 51 | // playing the video at a given time. |
||
| 52 | 'start' => 0, |
||
| 53 | |||
| 54 | // Values: 0 or 1. Default is 0. Enable the Javascript API by setting this parameter |
||
| 55 | // to 1. For more information and instructions on using the Javascript API, see the |
||
| 56 | // JavaScript API documentation. |
||
| 57 | 'enableApi' => 0, |
||
| 58 | |||
| 59 | // Values: 0 or 1. Default is 0. Determines if the player should display controls |
||
| 60 | // or not during video playback. |
||
| 61 | 'chromeless' => 0, |
||
| 62 | |||
| 63 | // Values: 0 or 1. Default is 0. Determines if the video should be expended to fit |
||
| 64 | // the whole player's size. |
||
| 65 | 'expendVideo' => 0, |
||
| 66 | 'color2' => null, |
||
| 67 | |||
| 68 | // Player color changes may be set using color codes. A color is described by its |
||
| 69 | // hexadecimal value (eg: FF0000 for red). |
||
| 70 | 'foreground' => null, |
||
| 71 | 'background' => null, |
||
| 72 | 'highlight' => null, |
||
| 73 | ]; |
||
| 74 | |||
| 75 | $player_parameters = array_merge($defaults, $options['player_parameters'] ?? []); |
||
| 76 | |||
| 77 | $box = $this->getBoxHelperProperties($media, $format, $options); |
||
| 78 | |||
| 79 | $params = [ |
||
| 80 | 'player_parameters' => http_build_query($player_parameters), |
||
| 81 | 'allowFullScreen' => $options['allowFullScreen'] ?? 'true', |
||
| 82 | 'allowScriptAccess' => $options['allowScriptAccess'] ?? 'always', |
||
| 83 | 'width' => $box->getWidth(), |
||
| 84 | 'height' => $box->getHeight(), |
||
| 85 | ]; |
||
| 86 | |||
| 87 | return $params; |
||
| 88 | } |
||
| 89 | |||
| 177 |