Code Duplication    Length = 5-5 lines in 2 locations

src/CertainRessourceAbstract.php 2 locations

@@ 86-90 (lines=5) @@
83
            throw new Exceptions\RessourceException('No ressource name provided.');
84
        }
85
        if ($ressourceId === null && count($this->getMandatoryFields()) > 0) {
86
            foreach ($this->getMandatoryFields() as $field) {
87
                if (!in_array($field, array_keys($bodyData))) {
88
                    throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required',
89
                        $field));
90
                }
91
            }
92
        }
93
        $this->results = $this->certainApiService->post($ressourceName,
@@ 119-123 (lines=5) @@
116
            throw new Exceptions\RessourceException('No ressource name provided.');
117
        }
118
        if (!is_null($ressourceId) && count($this->getMandatoryFields()) > 0) {
119
            foreach ($this->getMandatoryFields() as $field) {
120
                if (!in_array($field, array_keys($bodyData))) {
121
                    throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required',
122
                        $field));
123
                }
124
            }
125
        } else {
126
            throw new Exceptions\RessourceMandatoryFieldException(sprintf('The id field is required'));