Code Duplication    Length = 5-5 lines in 2 locations

src/CertainRessourceAbstract.php 2 locations

@@ 80-84 (lines=5) @@
77
            throw new Exceptions\RessourceException('No ressource name provided.');
78
        }
79
        if($ressourceId === null && count($this->getMandatoryFields())>0){
80
            foreach ($this->getMandatoryFields() as $field) {
81
                if(!in_array($field,  array_keys($bodyData))){
82
                    throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required',$field));
83
                }
84
            }
85
        }
86
        $this->results = $this->certainApiService->post($ressourceName, $this->ressourceCalled, $ressourceId, $bodyData, $query, $assoc, $contentType);
87
        return $this;
@@ 107-111 (lines=5) @@
104
            throw new Exceptions\RessourceException('No ressource name provided.');
105
        }
106
        if(!is_null($ressourceId) && count($this->getMandatoryFields())>0){
107
            foreach ($this->getMandatoryFields() as $field) {
108
                if(!in_array($field,  array_keys($bodyData))){
109
                    throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required',$field));
110
                }
111
            }
112
        }else{
113
            throw new Exceptions\RessourceMandatoryFieldException(sprintf('The id field is required'));
114
        }