| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 51 |
| 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 |
||
| 75 | function get_audiortc_output() { |
||
| 76 | $out = '<div class="container-fluid">'."\n"; |
||
| 77 | $out .= ' <div class="row hide">'."\n"; |
||
| 78 | $out .= ' <div class="col-sm-12">'."\n"; |
||
| 79 | $out .= ' <div id="alert-warning" class="alert alert-warning"><strong>' |
||
| 80 | .get_string('browseralert_title', 'tinymce_recordrtc').'</strong> ' |
||
| 81 | .get_string('browseralert', 'tinymce_recordrtc').'</div>'."\n"; |
||
| 82 | $out .= ' </div>'."\n"; |
||
| 83 | $out .= ' </div>'."\n"; |
||
| 84 | $out .= ' <div class="row hide">'."\n"; |
||
| 85 | $out .= ' <div class="col-sm-12">'."\n"; |
||
| 86 | $out .= ' <div id="alert-danger" class="alert alert-danger"></div>'."\n"; |
||
| 87 | $out .= ' </div>'."\n"; |
||
| 88 | $out .= ' </div>'."\n"; |
||
| 89 | $out .= ' <div class="row hide">'."\n"; |
||
| 90 | $out .= ' <div class="col-sm-1">'."\n"; |
||
| 91 | $out .= ' </div>'."\n"; |
||
| 92 | $out .= ' <div class="col-sm-10">'."\n"; |
||
| 93 | $out .= ' <audio id="player"></audio>'."\n"; |
||
| 94 | $out .= ' </div>'."\n"; |
||
| 95 | $out .= ' <div class="col-sm-1">'."\n"; |
||
| 96 | $out .= ' </div>'."\n"; |
||
| 97 | $out .= ' </div>'."\n"; |
||
| 98 | $out .= ' <div class="row">'."\n"; |
||
| 99 | $out .= ' <div class="col-sm-1">'."\n"; |
||
| 100 | $out .= ' </div>'."\n"; |
||
| 101 | $out .= ' <div class="col-sm-10">'."\n"; |
||
| 102 | $out .= ' <button id="start-stop" class="btn btn-lg btn-outline-danger btn-block">' |
||
| 103 | .get_string('startrecording', 'tinymce_recordrtc').'</button>'."\n"; |
||
| 104 | $out .= ' </div>'."\n"; |
||
| 105 | $out .= ' <div class="col-sm-1">'."\n"; |
||
| 106 | $out .= ' </div>'."\n"; |
||
| 107 | $out .= ' </div>'."\n"; |
||
| 108 | $out .= ' <div class="row hide">'."\n"; |
||
| 109 | $out .= ' <div class="col-sm-3">'."\n"; |
||
| 110 | $out .= ' </div>'."\n"; |
||
| 111 | $out .= ' <div class="col-sm-6">'."\n"; |
||
| 112 | $out .= ' <button id="upload" class="btn btn-primary btn-block">' |
||
| 113 | .get_string('attachrecording', 'tinymce_recordrtc').'</button>'."\n"; |
||
| 114 | $out .= ' </div>'."\n"; |
||
| 115 | $out .= ' <div class="col-sm-3">'."\n"; |
||
| 116 | $out .= ' </div>'."\n"; |
||
| 117 | $out .= ' </div>'."\n"; |
||
| 118 | $out .= '</div>'."\n"; |
||
| 119 | |||
| 120 | // Because there is no relative path to TinyMCE, we have to use JavaScript |
||
| 121 | // to work out correct path from the .js files from TinyMCE. Only files |
||
| 122 | // inside this plugin can be included with relative path (below). |
||
| 123 | $out .= '<script type="text/javascript">'."\n"; |
||
| 124 | $out .= ' var editor_tinymce_include = function(path) {'."\n"; |
||
| 125 | $out .= ' document.write(\'<script type="text/javascript" src="\' + parent.tinyMCE.baseURL + \'/\' + path + \'"></\' + |
||
| 126 | \'script>\');'."\n"; |
||
| 127 | $out .= ' };'."\n"; |
||
| 128 | $out .= ' editor_tinymce_include(\'tiny_mce_popup.js\');'."\n"; |
||
| 129 | $out .= ' editor_tinymce_include(\'utils/validate.js\');'."\n"; |
||
| 130 | $out .= ' editor_tinymce_include(\'utils/form_utils.js\');'."\n"; |
||
| 131 | $out .= ' editor_tinymce_include(\'utils/editable_selects.js\');'."\n"; |
||
| 132 | $out .= '</script>'."\n"; |
||
| 133 | return $out; |
||
| 134 | } |
||
| 135 |