Code Duplication    Length = 10-12 lines in 3 locations

src/Oci8/Schema/Sequence.php 3 locations

@@ 98-109 (lines=12) @@
95
     * @param  string $name
96
     * @return bool
97
     */
98
    public function exists($name)
99
    {
100
        if (! $name) {
101
            return false;
102
        }
103
104
        $name = $this->wrap($name);
105
106
        return $this->connection->selectOne(
107
            "select * from all_sequences where sequence_name=upper('{$name}') and sequence_owner=upper(user)"
108
        );
109
    }
110
111
    /**
112
     * get sequence next value.
@@ 117-126 (lines=10) @@
114
     * @param  string $name
115
     * @return int
116
     */
117
    public function nextValue($name)
118
    {
119
        if (! $name) {
120
            return 0;
121
        }
122
123
        $name = $this->wrap($name);
124
125
        return $this->connection->selectOne("SELECT $name.NEXTVAL as id FROM DUAL")->id;
126
    }
127
128
    /**
129
     * same function as lastInsertId. added for clarity with oracle sql statement.
@@ 145-155 (lines=11) @@
142
     * @param  string $name
143
     * @return int
144
     */
145
    public function lastInsertId($name)
146
    {
147
        // check if a valid name and sequence exists
148
        if (! $name || ! $this->exists($name)) {
149
            return 0;
150
        }
151
152
        $name = $this->wrap($name);
153
154
        return $this->connection->selectOne("select {$name}.currval as id from dual")->id;
155
    }
156
}
157