Code Duplication    Length = 5-6 lines in 2 locations

src/Database.php 1 location

@@ 80-84 (lines=5) @@
77
     */
78
    public function entity($entity)
79
    {
80
        if (class_exists($entity)) {
81
            return new $entity($this);
82
        } else {
83
            throw new EntityNotFound('['.$entity.'] not found');
84
        }
85
    }
86
87
    /**

src/Query.php 1 location

@@ 134-139 (lines=6) @@
131
    public function entity($entity = null)
132
    {
133
        if (func_num_args() > 0) {
134
            if (class_exists($entity)) {
135
                $this->flush();
136
                $this->class_name = $entity;
137
            } else {
138
                throw new EntityNotFound('['.$entity.'] not found');
139
            }
140
141
            return $this;
142
        }