public function setTransformation($transformation)
    {
        if (is_callable($transformation)) {
            $this->transformationMethod = $transformation;

            return $this;
        }

        // replace just to avoid wrongly passing the name containing "Transformation".
        $methodName = str_replace('Transformation', '', $transformation) . "Transformation";

        if (! method_exists($this, $methodName)) {
            throw new TransformerException("No such transformation as $methodName defined.");
        }

        $this->transformationMethod = [$this, $methodName];

        return $this;
    }
public function setTransformation($transformation)
    {
        if (is_callable($transformation)) {
            $this->transformationMethod = $transformation;

            return $this;
        }

        // replace just to avoid wrongly passing the name containing "Transformation".
        $methodName = str_replace('Transformation', '', $transformation) . "Transformation";

        if (! method_exists($this, $methodName)) {
            throw new TransformerException("No such transformation as $methodName defined.");
        }

        $this->transformationMethod = [$this, $methodName];

        return $this;
    }
public function setTransformation ( $ transformation ) { if ( is_callable ( $ transformation ) ) { $ this -> transformationMethod = $ transformation ; return $ this ; } // replace just to avoid wrongly passing the name containing "Transformation". $ methodName = str_replace ( 'Transformation' , '' , $ transformation ) . "Transformation" ; if ( ! method_exists ( $ this , $ methodName ) ) { throw new TransformerException ( "No such transformation as $methodName defined." ) ; } $ this -> transformationMethod = [ $ this , $ methodName ] ; return $ this ; }
Sets the current transformation.

@param $transformation
@return $this
@throws TransformerException
Sets the current transformation .