Code Duplication    Length = 15-16 lines in 2 locations

src/Console/PrimaryIndexCreatorCommand.php 1 location

@@ 89-104 (lines=16) @@
86
    /**
87
     * Execute the console command
88
     */
89
    public function fire()
90
    {
91
        /** @var \Illuminate\Database\Connection|CouchbaseConnection $connection */
92
        $connection = $this->databaseManager->connection($this->option('database'));
93
        if ($connection instanceof CouchbaseConnection) {
94
            $bucket = $connection->openBucket($this->argument('bucket'));
95
            $bucket->manager()->createN1qlPrimaryIndex(
96
                $this->option('name'),
97
                $this->option('ignore'),
98
                $this->option('defer')
99
            );
100
            $this->info("created PRIMARY INDEX [{$this->option('name')}] for [{$this->argument('bucket')}] bucket.");
101
        }
102
103
        return;
104
    }
105
}
106

src/Console/PrimaryIndexRemoverCommand.php 1 location

@@ 83-97 (lines=15) @@
80
    /**
81
     * Execute the console command
82
     */
83
    public function fire()
84
    {
85
        /** @var \Illuminate\Database\Connection|CouchbaseConnection $connection */
86
        $connection = $this->databaseManager->connection($this->option('database'));
87
        if ($connection instanceof CouchbaseConnection) {
88
            $bucket = $connection->openBucket($this->argument('bucket'));
89
            $bucket->manager()->dropN1qlPrimaryIndex(
90
                $this->option('name'),
91
                $this->option('ignore')
92
            );
93
            $this->info("dropped PRIMARY INDEX [{$this->option('name')}] for [{$this->argument('bucket')}] bucket.");
94
        }
95
96
        return;
97
    }
98
}
99