Code Duplication    Length = 12-12 lines in 4 locations

src/WebHemi/Data/Storage/AccessManagement/PolicyStorage.php 1 location

@@ 125-136 (lines=12) @@
122
     *
123
     * @return bool|PolicyEntity
124
     */
125
    public function getPolicyByName($name)
126
    {
127
        $entity = false;
128
        $dataList = $this->getDataAdapter()->getDataSet([$this->name => $name], 1);
129
130
        if (!empty($dataList)) {
131
            $entity = $this->createEntity();
132
            $this->populateEntity($entity, $dataList[0]);
133
        }
134
135
        return $entity;
136
    }
137
138
    /**
139
     * Returns a set of Policy entities identified by Resource ID.

src/WebHemi/Data/Storage/User/UserGroupStorage.php 1 location

@@ 109-120 (lines=12) @@
106
     *
107
     * @return bool|UserGroupEntity
108
     */
109
    public function getUserGroupByName($name)
110
    {
111
        $entity = false;
112
        $dataList = $this->getDataAdapter()->getDataSet([$this->name => $name], 1);
113
114
        if (!empty($dataList)) {
115
            $entity = $this->createEntity();
116
            $this->populateEntity($entity, $dataList[0]);
117
        }
118
119
        return $entity;
120
    }
121
}
122

src/WebHemi/Data/Storage/User/UserStorage.php 2 locations

@@ 117-128 (lines=12) @@
114
     *
115
     * @return bool|UserEntity
116
     */
117
    public function getUserByUserName($name)
118
    {
119
        $entity = false;
120
        $dataList = $this->getDataAdapter()->getDataSet([$this->userName => $name], 1);
121
122
        if (!empty($dataList)) {
123
            $entity = $this->createEntity();
124
            $this->populateEntity($entity, $dataList[0]);
125
        }
126
127
        return $entity;
128
    }
129
130
    /**
131
     * Returns a User entity by email.
@@ 137-148 (lines=12) @@
134
     *
135
     * @return bool|UserEntity
136
     */
137
    public function getUserByEmail($email)
138
    {
139
        $entity = false;
140
        $dataList = $this->getDataAdapter()->getDataSet([$this->email => $email], 1);
141
142
        if (!empty($dataList)) {
143
            $entity = $this->createEntity();
144
            $this->populateEntity($entity, $dataList[0]);
145
        }
146
147
        return $entity;
148
    }
149
}
150