pingpong-labs / modules

Laravel 5 Modules
https://pingpong-labs.github.io/docs/modules.html
BSD 3-Clause "New" or "Revised" License
576 stars 151 forks source link

Helpers override compatibility #255

Open bsh314 opened 8 years ago

bsh314 commented 8 years ago

After installing this package in rappasoft/laravel-boilerplate it causes Missing argument 1 for gravatar() ErrorException Becose of that gravatar()_.get(...) is used by in trait named UserAttribute with path app/Models/Access/User/Traits/Attribute/UserAttribute.php that function is already providen by app/helpers.php, so after re-defining it in vendor/pingpong/support/helpers.php.

Currently this problem can be solved by commenting gravatar function on vendor/pingpong/support/helpers.php, but i think it should be not re-defined in this case

rappasoft/helpers definition:

if (! function_exists('gravatar')) {
    /**
     * Access the gravatar helper
     */
    function gravatar()
    {
        return app('gravatar');
    }
}

pingpong/support/helpers definition:

if (!function_exists('gravatar')) {
    /**
     * Gravatar URL from Email address.
     *
     * @param string $email   Email address
     * @param string $size    Size in pixels
     * @param string $default Default image [ 404 | mm | identicon | monsterid | wavatar ]
     * @param string $rating  Max rating [ g | pg | r | x ]
     *
     * @return string
     */
    function gravatar($email, $size = 60, $default = 'mm', $rating = 'g')
    {
        return 'http://www.gravatar.com/avatar/'.md5(strtolower(trim($email)))."?s={$size}&d={$default}&r={$rating}";
    }
}

Other functions defined in helpers may cause same problems in other projects, anyone had this problem?