• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / services / 7322930216

25 Dec 2023 04:02PM UTC coverage: 10.534% (-0.8%) from 11.327%
7322930216

push

github

twinh
ci: add PHP 8, remove PHP 7.2, 7.3

69 of 655 relevant lines covered (10.53%)

10.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Service/ShowAction.php
1
<?php
2

3
namespace Miaoxing\Services\Service;
4

5
use Miaoxing\Plugin\BaseModel;
6
use Miaoxing\Services\Action\BaseAction;
7
use Wei\BaseController;
8
use Wei\Ret;
9

10
class ShowAction extends BaseAction
11
{
12
    /**
13
     * @param BaseController $controller
14
     * @return Ret
15
     * @throws \Exception
16
     * @svc
17
     */
18
    protected function exec(BaseController $controller)
19
    {
20
        $model = $this->convention->createModel($controller);
×
21

22
        $this->triggerRet('beforeFind', [$model, $this->req]);
×
23

24
        $model->findOrFail($this->req['id']);
×
25

26
        $this->triggerRet('afterFind', [$model, $this->req]);
×
27

28
        $this->includeModel($controller, $model);
×
29

30
        return $model->toRet([
×
31
            'data' => array_merge($model->toArray(), $this->triggerBuildData($model)),
×
32
        ]);
×
33
    }
34

35
    /**
36
     * @param callable $callable
37
     * @return $this
38
     * @svc
39
     */
40
    protected function beforeFind(callable $callable)
41
    {
42
        return $this->on(__FUNCTION__, $callable);
×
43
    }
44

45
    /**
46
     * @param callable $callable
47
     * @return $this
48
     * @svc
49
     */
50
    protected function afterFind(callable $callable)
51
    {
52
        return $this->on(__FUNCTION__, $callable);
×
53
    }
54

55
    /**
56
     * @param callable $callable
57
     * @return $this
58
     * @svc
59
     */
60
    protected function buildData(callable $callable)
61
    {
62
        return $this->on(__FUNCTION__, $callable);
×
63
    }
64

65
    private function triggerBuildData($model)
66
    {
67
        return $this->trigger('buildData', [$model]) ?: [];
×
68
    }
69

70
    private function includeModel(BaseController $controller, BaseModel $model)
71
    {
72
        $model->load($controller->getOption('include'));
×
73
    }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc