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

phpolar / model / 15338053003

30 May 2025 02:46AM UTC coverage: 90.391%. First build
15338053003

Pull #122

github

web-flow
Merge 2b12e33c7 into 548609d0b
Pull Request #122: 121 add json modelresolver

11 of 14 new or added lines in 6 files covered. (78.57%)

254 of 281 relevant lines covered (90.39%)

3.72 hits per line

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

100.0
/src/EntityNameConfigurationTrait.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Phpolar\Model;
6

7
use ReflectionClass;
8
use ReflectionObject;
9

10
/**
11
 * Allows for configuring the name of entity.
12
 */
13
trait EntityNameConfigurationTrait
14
{
15
    /**
16
     * Returns the name of the entity
17
     *
18
     * @api
19
     */
20
    public function getName(): string
21
    {
22
        $attrs = (new ReflectionObject($this))->getAttributes(EntityName::class);
2✔
23
        if (count($attrs) < 1) {
2✔
24
            return (new ReflectionClass(static::class))->getShortName();
1✔
25
        }
26
        $attr = $attrs[0];
1✔
27
        return $attr->newInstance()->getName();
1✔
28
    }
29
}
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