GaretJax / phpbrowscap

Standalone replacement for php's native get_browser() function
MIT License
429 stars 69 forks source link

Provide a setter for public property "localfile" #76

Open sweiguny opened 7 years ago

sweiguny commented 7 years ago

I am using symfony and phpbrowscap as service defined in services.yml.

currently, my definition in services.yml look like this:

browscap:
        class: phpbrowscap\Browscap
        arguments:
            - %browscap_cache_dir%

I'd like to set the property "localfile" initially, but thats not possible in services.yml, because it only allows to inject variables in the constructor and/or additionally calling a certain setter.

having this setter would help here. i personally don't see a reason for not having a setter.

sweiguny commented 7 years ago

Fixed that by adding this:

        properties:
            localfile: %browscap_ini%

but anyway, a setter would be great.

as i am facing the issue, that browscap loads the file from the server, even when i set localfile, i think the setter should also prevent the class to load the file from the server.