Completed
Push — master ( c7757e...39cb21 )
by Luís
16s
created

Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php (1 issue)

1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace Doctrine\DBAL\Platforms;
21
22
use Doctrine\Common\Proxy\Exception\UnexpectedValueException;
23
use Doctrine\DBAL\Schema\Index;
24
25
/**
26
 * The SQLAnywhere16Platform provides the behavior, features and SQL dialect of the
27
 * SAP Sybase SQL Anywhere 16 database platform.
28
 *
29
 * @author Steve Müller <[email protected]>
30
 * @link   www.doctrine-project.org
31
 * @since  2.5
32
 */
33
class SQLAnywhere16Platform extends SQLAnywhere12Platform
34
{
35
    /**
36
     * {@inheritdoc}
37
     */
38 9
    protected function getAdvancedIndexOptionsSQL(Index $index)
39
    {
40 9
        if ($index->hasFlag('with_nulls_distinct') && $index->hasFlag('with_nulls_not_distinct')) {
41 1
            throw new UnexpectedValueException(
42 1
                'An Index can either have a "with_nulls_distinct" or "with_nulls_not_distinct" flag but not both.'
43
            );
44
        }
45
46 8 View Code Duplication
        if ( ! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_distinct')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
47 1
            return ' WITH NULLS DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
48
        }
49
50 8
        return parent::getAdvancedIndexOptionsSQL($index);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 54
    protected function getReservedKeywordsClass()
57
    {
58 54
        return Keywords\SQLAnywhere16Keywords::class;
59
    }
60
}
61