configuration ); if ( $converter instanceof ConverterInterface ) { $this->converter = $converter; }else{ throw new ErrorException('Wrong type of converter'); } } public function convertTo( $method, $value, $attributes = [] ){ if ( $attributes ) { $this->converter->setAttributes($attributes); } return $this->converter->$method( $value ); } public function convertByConfiguration( $value, $configuration ){ return $this->converter->convertByConfiguration( $value, $configuration ); } }