Skip to content

Add ParsePolygon Type and polygonContains query #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ logs

# ignore test results
phpunit-test-results

*.log

coverage.xml

# ignore phpdoc
output/
21 changes: 17 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,27 @@ php:
# - nightly
before_install:
- nvm install 6.11
install:
- sudo apt-get install graphviz
install:
# fix for jms/serializer 1.7.1 not being able to run on 5.4
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.4" ]]; then composer require jms/serializer; fi
- composer install
- npm install
before_script:
- npm start 1>&2
- sleep 3
- npm run lint
script:
- ./vendor/bin/phpunit --coverage-clover=coverage.xml

- npm run test:coverage
- npm run document-check && if [[ `cat "output/checkstyle.xml" | grep "<error "` != "" ]]; then exit 1; fi
before_deploy:
- npm run document
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: output
on:
branch: master
after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To setup the Test Parse Server:
* Run `npm install` from the project root to download the server and it's dependencies.
* When you're ready to run tests use `npm start` from the project root to boot up the test server.

The embedded test server utilizes this [parse server test] project.
The embedded test server utilizes this [parse server test] project.
It's setup with the appropriate configuration to run the php sdk test suite.
Additionally it handles setting up mongodb for the server.

Expand Down Expand Up @@ -65,6 +65,18 @@ You should now be able to execute the tests, from project root folder:

./vendor/bin/phpunit

You may also run tests directly using phpunit as follows:

npm test

Make sure your code is linted with phpcs ([PSR-2 Coding Style]):

npm run lint

You can automatically fix lint errors with phpcbf:

npm run lint:fix

The test suite is setup for code coverage if you have [XDebug] installed and setup.
Coverage is outputted as text and as html in the phpunit-test-results/ directory within the project root.

Expand All @@ -79,3 +91,5 @@ If you have XDebug setup and can view code coverage please ensure that you do yo
[XDebug]: https://xdebug.org/
[parse server test]: https://github.com/montymxb/parse-server-test
[Setup a local Parse Server instance]: https://github.com/parse-community/parse-server#user-content-locally
[PSR-2 Coding Style]: http://www.php-fig.org/psr/psr-2/

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ For example if your parse server's url is `http://example.com:1337/parse` then y

`ParseClient::setServerURL('https://example.com:1337','parse');`

Getting Started
---------------

We highly recommend you read through the [guide](http://docs.parseplatform.org/php/guide/) first. This will walk you through the basics of working with this sdk, as well as provide insight into how to best develop your project.

If want to know more about what makes the php sdk tick you can read our [API Reference](http://parseplatform.org/parse-php-sdk/namespaces/Parse.html) and flip through the code on [github](https://github.com/parse-community/parse-php-sdk/).

Http Clients
------------
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~1.5",
"phpdocumentor/phpdocumentor": "~2.5"
"squizlabs/php_codesniffer": "^3.0.1",
"phpdocumentor/phpdocumentor": "~2.9",
"jms/serializer": "1.7.1"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "parse-php-sdk",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "./vendor/bin/phpunit",
"test:coverage": "./vendor/bin/phpunit --coverage-clover=coverage.xml",
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"lint:fix": "./vendor/bin/phpcbf --standard=./phpcs.xml.dist ./src/Parse ./tests/Parse",
"start" : "./node_modules/parse-server-test/run-server",
"stop" : "./node_modules/parse-server-test/stop-server"
"stop" : "./node_modules/parse-server-test/stop-server",
"document-check" : "./vendor/bin/phpdoc -d ./src/ --template=checkstyle",
"document" : "./vendor/bin/phpdoc -d ./src/ --title 'Parse PHP SDK API Reference' --template='responsive-twig'"
},
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="phpcsignore">
<description>PHPCS Ignore Rule</description>
<rule ref="PSR2" />
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.MethodDeclaration">
<severity>0</severity>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<severity>0</severity>
</rule>
</ruleset>
44 changes: 14 additions & 30 deletions src/Parse/HttpClients/ParseCurl.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php
/**
* ParseCurl - Wrapper for abstracted curl usage
*
* @author Ben Friedman <[email protected]>
* Class ParseCurl | Parse/HttpClients/ParseCurl.php
*/

namespace Parse\HttpClients;


use Parse\ParseException;

/**
* Class ParseCurl
* Class ParseCurl - Wrapper for abstracted curl usage
*
* @author Ben Friedman <[email protected]>
* @package Parse\HttpClients
*/
class ParseCurl
{
/**
* Curl handle
*
* @var resource
*/
private $curl;
Expand All @@ -27,11 +27,9 @@ class ParseCurl
*/
public function init()
{
if($this->curl === null) {
if ($this->curl === null) {
$this->curl = curl_init();

}

}

/**
Expand All @@ -42,9 +40,8 @@ public function init()
*/
public function exec()
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

return curl_exec($this->curl);
Expand All @@ -59,13 +56,11 @@ public function exec()
*/
public function setOption($option, $value)
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

curl_setopt($this->curl, $option, $value);

}

/**
Expand All @@ -76,13 +71,11 @@ public function setOption($option, $value)
*/
public function setOptionsArray($options)
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

curl_setopt_array($this->curl, $options);

}

/**
Expand All @@ -94,13 +87,11 @@ public function setOptionsArray($options)
*/
public function getInfo($info)
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

return curl_getinfo($this->curl, $info);

}

/**
Expand All @@ -111,13 +102,11 @@ public function getInfo($info)
*/
public function getError()
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

return curl_error($this->curl);

}

/**
Expand All @@ -128,31 +117,26 @@ public function getError()
*/
public function getErrorCode()
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

return curl_errno($this->curl);

}

/**
* Closed our curl handle and disposes of it
*/
public function close()
{
if(!isset($this->curl)) {
if (!isset($this->curl)) {
throw new ParseException('You must call ParseCurl::init first');

}

// close our handle
curl_close($this->curl);

// unset our curl handle
$this->curl = null;

}

}
}
Loading