Conditions | 5 |
Paths | 6 |
Total Lines | 28 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5.0187 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 12 | public function googleAnalytics($trackingCode = null) |
|
16 | { |
||
17 | 12 | if (!is_string($trackingCode)) { |
|
18 | 12 | global $application; |
|
19 | 12 | if ($application instanceof Zend_Application) { |
|
20 | 12 | $trackingCode = $application->getOption('googleAnalyticsTrackingCode', null); |
|
21 | } |
||
22 | } |
||
23 | |||
24 | 12 | $trackingCode = trim($trackingCode); |
|
25 | 12 | if (!is_string($trackingCode) || empty($trackingCode)) { |
|
26 | return ''; |
||
27 | } |
||
28 | |||
29 | $result = <<<STRING |
||
30 | <script type="text/javascript"> |
||
31 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
||
32 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
||
33 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
||
34 | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
||
35 | |||
36 | 12 | ga('create', '$trackingCode', 'auto'); |
|
37 | ga('send', 'pageview'); |
||
38 | 12 | </script> |
|
39 | STRING; |
||
40 | |||
41 | 12 | return $result; |
|
42 | } |
||
43 | } |
||
44 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.