Conditions | 1 |
Paths | 1 |
Total Lines | 117 |
Code Lines | 92 |
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 |
||
36 | public function provideShortCode() |
||
37 | { |
||
38 | return array( |
||
39 | array( |
||
40 | '[mauticform id="1"]', |
||
41 | '<script type="text/javascript" src="http://example.com/form/generate.js?id=1"></script>' |
||
42 | ), |
||
43 | array( |
||
44 | '[mautic type="form" id="1"]', |
||
45 | '<script type="text/javascript" src="http://example.com/form/generate.js?id=1"></script>' |
||
46 | ), |
||
47 | array( |
||
48 | '[mautictags values="tag,-tag2,tag3"]', |
||
49 | '<img src="http://example.com/mtracking.gif?tags=tag,-tag2,tag3" alt="Mautic Tags" />' |
||
50 | ), |
||
51 | array( |
||
52 | '[mautic type="tags" values="tag,tag2,-tag3"]', |
||
53 | '<img src="http://example.com/mtracking.gif?tags=tag,tag2,-tag3" alt="Mautic Tags" />' |
||
54 | ), |
||
55 | array( |
||
56 | '[mautictags values="tag,-tag2,tag3"]', |
||
57 | '<img src="http://example.com/mtracking.gif?tags=tag,-tag2,tag3" alt="Mautic Tags" />' |
||
58 | ), |
||
59 | array( |
||
60 | '[mautic type="tags" values="tag,tag2,-tag3"]', |
||
61 | '<img src="http://example.com/mtracking.gif?tags=tag,tag2,-tag3" alt="Mautic Tags" />' |
||
62 | ), |
||
63 | array( |
||
64 | '[mauticfocus id="1"]', |
||
65 | '<script type="text/javascript" src="http://example.com/focus/1.js" async="async"></script>' |
||
66 | ), |
||
67 | array( |
||
68 | '[mautic type="focus" id="1"]', |
||
69 | '<script type="text/javascript" src="http://example.com/focus/1.js" async="async"></script>' |
||
70 | ), |
||
71 | array( |
||
72 | '[mauticcontent slot="name"]content[/mauticcontent]', |
||
73 | '<div class="mautic-slot" data-slot-name="name">content</div>' |
||
74 | ), |
||
75 | array( |
||
76 | '[mautic type="content" slot="name"]content[/mautic]', |
||
77 | '<div class="mautic-slot" data-slot-name="name">content</div>' |
||
78 | ), |
||
79 | array( |
||
80 | '[mautic type="video" src="https://www.youtube.com/watch?v=1234" form-id="1" width="148"]', |
||
81 | '<video height="360" width="148" data-form-id="1" data-gate-time="15">' . |
||
82 | '<source type="video/youtube" src="https://www.youtube.com/watch?v=1234" />' . |
||
83 | '</video>' |
||
84 | ), |
||
85 | array( |
||
86 | '[mauticvideo src="https://www.youtube.com/watch?v=1234" form-id="1" width="148"]', |
||
87 | '<video height="360" width="148" data-form-id="1" data-gate-time="15">' . |
||
88 | '<source type="video/youtube" src="https://www.youtube.com/watch?v=1234" />' . |
||
89 | '</video>' |
||
90 | ), |
||
91 | array( |
||
92 | '[mautic type="video" src="https://vimeo.com/218680983" form-id="1" height="272"]', |
||
93 | '<video height="272" width="640" data-form-id="1" data-gate-time="15">' . |
||
94 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
95 | '</video>' |
||
96 | ), |
||
97 | array( |
||
98 | '[mauticvideo src="https://vimeo.com/218680983" form-id="1" height="272"]', |
||
99 | '<video height="272" width="640" data-form-id="1" data-gate-time="15">' . |
||
100 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
101 | '</video>' |
||
102 | ), |
||
103 | array( |
||
104 | '[mautic type="video" src="https://vimeo.com/218680983" form-id="1" gate-time="25"]', |
||
105 | '<video height="360" width="640" data-form-id="1" data-gate-time="25">' . |
||
106 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
107 | '</video>' |
||
108 | ), |
||
109 | array( |
||
110 | '[mauticvideo src="https://vimeo.com/218680983" form-id="1" gate-time="25"]', |
||
111 | '<video height="360" width="640" data-form-id="1" data-gate-time="25">' . |
||
112 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
113 | '</video>' |
||
114 | ), |
||
115 | array( |
||
116 | '[mautic type="video" src="https://vimeo.com/218680983" form-id="1" video-type="mp4"]', |
||
117 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
118 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
119 | '</video>' |
||
120 | ), |
||
121 | array( |
||
122 | '[mauticvideo src="https://vimeo.com/218680983" form-id="1" video-type="mp4"]', |
||
123 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
124 | '<source type="video/vimeo" src="https://vimeo.com/218680983" />' . |
||
125 | '</video>' |
||
126 | ), |
||
127 | array( |
||
128 | '[mautic type="video" src="https://example.com/mavideo.mov" form-id="1" video-type="mov"]', |
||
129 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
130 | '<source type="video/mov" src="https://example.com/mavideo.mov" />' . |
||
131 | '</video>' |
||
132 | ), |
||
133 | array( |
||
134 | '[mauticvideo src="https://example.com/mavideo.mov" form-id="1" video-type="mov"]', |
||
135 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
136 | '<source type="video/mov" src="https://example.com/mavideo.mov" />' . |
||
137 | '</video>' |
||
138 | ), |
||
139 | array( |
||
140 | '[mautic type="video" src="https://example.com/mavideo.mp4" form-id="1"]', |
||
141 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
142 | '<source type="video/mp4" src="https://example.com/mavideo.mp4" />' . |
||
143 | '</video>' |
||
144 | ), |
||
145 | array( |
||
146 | '[mauticvideo src="https://example.com/mavideo.mp4" form-id="1"]', |
||
147 | '<video height="360" width="640" data-form-id="1" data-gate-time="15">' . |
||
148 | '<source type="video/mp4" src="https://example.com/mavideo.mp4" />' . |
||
149 | '</video>' |
||
150 | ), |
||
151 | ); |
||
152 | } |
||
153 | |||
246 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.