Code Duplication    Length = 12-13 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php 1 location

@@ 68-79 (lines=12) @@
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getNotificationById(int $notificationId): array
69
    {
70
        $query = $this->connection->createQueryBuilder();
71
        $query
72
            ->select(...$this->getColumns())
73
            ->from(self::TABLE_NOTIFICATION)
74
            ->where($query->expr()->eq(self::COLUMN_ID, ':id'));
75
76
        $query->setParameter(':id', $notificationId, PDO::PARAM_INT);
77
78
        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
79
    }
80
81
    /**
82
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php 1 location

@@ 117-129 (lines=13) @@
114
    /**
115
     * {@inheritdoc}
116
     */
117
    public function countUserPreferences(int $userId): int
118
    {
119
        $query = $this->connection->createQueryBuilder();
120
        $query
121
            ->select(
122
                $this->connection->getDatabasePlatform()->getCountExpression(self::COLUMN_ID)
123
            )
124
            ->from(self::TABLE_USER_PREFERENCES)
125
            ->where($query->expr()->eq(self::COLUMN_USER_ID, ':user_id'))
126
            ->setParameter(':user_id', $userId, ParameterType::INTEGER);
127
128
        return (int) $query->execute()->fetchColumn();
129
    }
130
131
    private function getColumns(): array
132
    {