| Conditions | 4 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function actionIndex($page = null) |
||
| 24 | { |
||
| 25 | if (!$page) { |
||
|
|
|||
| 26 | $page = 'posts'; |
||
| 27 | } |
||
| 28 | |||
| 29 | $path = $this->module->find($page); |
||
| 30 | |||
| 31 | if ($path === null) { |
||
| 32 | throw new NotFoundHttpException(Yii::t('yii', 'Page not found.')); |
||
| 33 | } |
||
| 34 | |||
| 35 | $meta = $this->module->getMetadata($path); |
||
| 36 | |||
| 37 | if ($meta['type'] === 'dir') { |
||
| 38 | $index = PagesIndex::createFromDir($path); |
||
| 39 | |||
| 40 | return $this->render('@hiqdev/com/views/site/index', ['dataProvider' => $index->getDataProvider()]); |
||
| 41 | } else { |
||
| 42 | $page = AbstractPage::createFromFile($path); |
||
| 43 | |||
| 44 | return $this->renderPage($page); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 64 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: