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

miaoxing / services / 5029815303

pending completion
5029815303

push

github

twinh
feat(services): `DefaultsAction` 支持通过调用 `createModel` 方法获取模型

0 of 6 new or added lines in 1 file covered. (0.0%)

61 of 618 relevant lines covered (9.87%)

5.73 hits per line

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

0.0
/src/Service/DefaultsAction.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
/**
11
 * @mixin \StrMixin
12
 */
13
class DefaultsAction extends BaseAction
14
{
15
    /**
16
     * @param BaseController $controller
17
     * @return Ret
18
     * @svc
19
     */
20
    protected function exec(BaseController $controller): Ret
21
    {
NEW
22
        if (method_exists($controller, 'createModel')) {
×
NEW
23
            $model = $controller->createModel();
×
24
        } else {
NEW
25
            $file = (new \ReflectionClass($controller))->getFileName();
×
NEW
26
            $name = basename(dirname($file, 2));
×
27

NEW
28
            $name = $this->str->singularize($this->str->camel($name));
×
29

30
            /** @var BaseModel $model */
NEW
31
            $model = $this->wei->get($name . 'Model');
×
32
        }
33

34
        return $model->toRet();
×
35
    }
36
}
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

© 2025 Coveralls, Inc