private function findAdderMethod($obj, $key)
    {
        if (method_exists($obj, $method = 'add'.$key)) {
            return $method;
        }

        foreach ((array) StringUtil::singularify($key) as $singularForm) {
            if (method_exists($obj, $method = 'add'.$singularForm)) {
                return $method;
            }
        }

        if (method_exists($obj, $method = 'add'.rtrim($key, 's'))) {
            return $method;
        }

        if (substr($key, -3) === 'ies' && method_exists($obj, $method = 'add'.substr($key, 0, -3).'y')) {
            return $method;
        }
    }
private function findAdderMethod($obj, $key)
    {
        if (method_exists($obj, $method = 'add'.$key)) {
            return $method;
        }

        foreach ((array) StringUtil::singularify($key) as $singularForm) {
            if (method_exists($obj, $method = 'add'.$singularForm)) {
                return $method;
            }
        }

        if (method_exists($obj, $method = 'add'.rtrim($key, 's'))) {
            return $method;
        }

        if (substr($key, -3) === 'ies' && method_exists($obj, $method = 'add'.substr($key, 0, -3).'y')) {
            return $method;
        }
    }
private function findAdderMethod ( $ obj , $ key ) { if ( method_exists ( $ obj , $ method = 'add' . $ key ) ) { return $ method ; } foreach ( ( array ) StringUtil :: singularify ( $ key ) as $ singularForm ) { if ( method_exists ( $ obj , $ method = 'add' . $ singularForm ) ) { return $ method ; } } if ( method_exists ( $ obj , $ method = 'add' . rtrim ( $ key , 's' ) ) ) { return $ method ; } if ( substr ( $ key , - 3 ) === 'ies' && method_exists ( $ obj , $ method = 'add' . substr ( $ key , 0 , - 3 ) . 'y' ) ) { return $ method ; } }
Finds an adder method for the given object.
Thanks to the alice library for this code snippet.

@param mixed  $obj
@param string $key

@return string|null
Finds an adder method for the given object . Thanks to the alice library for this code snippet .