Issues (265)

src/Schema/Traits/ElementTrait.php (1 issue)

1
<?php
2
3
/**
4
 * This file is part of Cycle ORM package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\Database\Schema\Traits;
13
14
use Cycle\Database\Driver\Driver;
15
16
trait ElementTrait
17
{
18
    /**
19
     * Associated table name (full name).
20
     *
21
     * @psalm-return non-empty-string
22
     */
23 16
    public function getTable(): string
24
    {
25 16
        return $this->table;
26
    }
27
28
    /**
29
     * Set element name.
30
     *
31
     * @psalm-param non-empty-string $name
32
     */
33 112
    public function setName(string $name): self
34
    {
35 112
        $this->name = $name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
37 112
        return $this;
38
    }
39
40
    /**
41
     * Get element name (unquoted).
42
     *
43
     * @psalm-return non-empty-string
44
     */
45 1950
    public function getName(): string
46
    {
47 1950
        return $this->name;
48
    }
49
50
    /**
51
     * Element creation/definition syntax (specific to parent driver).
52
     */
53
    abstract public function sqlStatement(Driver $driver): string;
54
}
55