Conditions | 10 |
Paths | 80 |
Total Lines | 36 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 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 getDynamicMetadata(): array |
||
26 | { |
||
27 | $array = []; |
||
28 | |||
29 | if ($this->canUseCanonicalUrl()) { |
||
30 | $array[] = '<link rel="canonical" href="'.$this->getCanonicalUrl().'" />'; |
||
31 | } |
||
32 | |||
33 | if ($this->canUseSitemapLink()) { |
||
34 | $array[] = '<link rel="sitemap" type="application/xml" title="Sitemap" href="'.Hyde::url('sitemap.xml').'" />'; |
||
35 | } |
||
36 | |||
37 | if ($this->canUseRssFeedLink()) { |
||
38 | $array[] = $this->makeRssFeedLink(); |
||
39 | } |
||
40 | |||
41 | if (isset($this->title)) { |
||
42 | if ($this->hasTwitterTitleInConfig()) { |
||
43 | $array[] = '<meta name="twitter:title" content="'.$this->htmlTitle().'" />'; |
||
44 | } |
||
45 | if ($this->hasOpenGraphTitleInConfig()) { |
||
46 | $array[] = '<meta property="og:title" content="'.$this->htmlTitle().'" />'; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | if ($this instanceof MarkdownPost) { |
||
51 | $array[] = "\n<!-- Blog Post Meta Tags -->"; |
||
52 | foreach ($this->getMetadata() as $name => $content) { |
||
53 | $array[] = Meta::name($name, $content); |
||
54 | } |
||
55 | foreach ($this->getMetaProperties() as $property => $content) { |
||
56 | $array[] = Meta::property($property, $content); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | return $array; |
||
61 | } |
||
117 |