Skip to content

Conversation

@ozzyogkush
Copy link

The major changes here are backwards-incompatible with the current version but significantly increase its re-usability.

  • This has been set up to be installable via Composer. You should rename the package to votesmart/php-votesmart however.
  • The source code is now namespaced as VoteSmart, and the VoteSmart class was renamed Api
  • The constructor no longer takes in VoteSmart method name and method attributes parameters. Instead it takes in an optional output type parameter and an environment key parameter used to locate the API token.
  • The config.php file is no longer used; the global definitions are removed. The options have defaults defined in the VoteSmart object, and the constructor can take in parameters to set the output type and the location in $_ENV where the supplied VoteSmart API token can be located.

Cleaned up formatting of VoteSmart class.
The major change here is that you can no longer query directly from the constructor. The constructor now takes in 2 parameters:

1.) the output type, with a default of 'XML'
2.) the location in the global $_ENV array where to check for the API token supplied by VoteSmart is stored, with a default of 'VOTESMART_API_KEY'

You can also set these directly using the methods setOutputType(), setEnvKey() and setApiToken().
… outputType. Updated the README to contain more useful information.
…file

Backwards incompatible refactor and restructure
…ace of VoteSmart.

Moved Api class to src directory
Created composer.json file and composer.lock files
Updated .gitignore to ignore Composer created vendor directory
Set up as composer package, set up namespace and rename primary class
@ozzyogkush
Copy link
Author

Just a comment - this doesn't have any unit tests yet, and this can be further refactored to re-use existing code via composer. This also does not have composer instructions in the README yet, nor has the example.php file been updated.

@ozzyogkush
Copy link
Author

Any chance this will get merged in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant