You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/07/12 14:53:55 UTC
svn commit: r676171 - in /incubator/shindig/trunk/php/src/socialrest:
DataRequestHandler.php http/RestRequestItem.php
Author: chabotc
Date: Sat Jul 12 05:53:54 2008
New Revision: 676171
URL: http://svn.apache.org/viewvc?rev=676171&view=rev
Log:
When will people learn to use isset / empty on array entries
Modified:
incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php
incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
Modified: incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php?rev=676171&r1=676170&r2=676171&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php Sat Jul 12 05:53:54 2008
@@ -29,7 +29,7 @@
// Anonymous requests are only allowed to GET data (not create/edit/delete)
$response = new ResponseItem(BAD_REQUEST, "", null);
} elseif ($method == 'GET') {
- $response = $this->handleGet($requestItem);
+ $response = $this->handleGet($requestItem);
} elseif ($method == 'POST') {
$response = $this->handlePost($requestItem);
} elseif ($method == 'DELETE') {
Modified: incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php?rev=676171&r1=676170&r2=676171&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php (original)
+++ incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php Sat Jul 12 05:53:54 2008
@@ -139,26 +139,38 @@
public function getStartIndex()
{
- $startIndex = $this->parameters[self::$START_INDEX];
- return $startIndex == null ? self::$DEFAULT_START_INDEX : $startIndex;
+ if (!empty(self::$DEFAULT_START_INDEX)) {
+ return self::$DEFAULT_START_INDEX;
+ } else {
+ return self::$DEFAULT_START_INDEX;
+ }
}
public function getCount()
{
- $count = $this->parameters[self::$COUNT];
- return $count == null ? self::$DEFAULT_COUNT : $count;
+ if (!empty($this->parameters[self::$COUNT])) {
+ return $this->parameters[self::$COUNT];
+ } else {
+ return self::$DEFAULT_COUNT;
+ }
}
public function getOrderBy()
{
- $orderBy = $this->parameters[self::$ORDER_BY];
- return $orderBy == null ? PeopleService::$sortOrder : $orderBy;
+ if (!empty($this->parameters[self::$ORDER_BY])) {
+ return $this->parameters[self::$ORDER_BY];
+ } else {
+ return PeopleService::$sortOrder;
+ }
}
public function getFilterBy()
{
- $filterBy = $this->parameters[self::$FILTER_BY];
- return $filterBy == null ? PeopleService::$filterType : $filterBy;
+ if (!empty($this->parameters[self::$FILTER_BY])) {
+ return $this->parameters[self::$FILTER_BY];
+ } else {
+ return PeopleService::$filterType;
+ }
}
public function getFields()
@@ -168,11 +180,12 @@
public function getFieldsWithDefaultValue(Array $defaultValue)
{
- $paramValue = $this->parameters[self::$FIELDS];
- if ($paramValue != null) {
+ if (!empty($this->parameters[self::$FIELDS])) {
+ $paramValue = $this->parameters[self::$FIELDS];
return explode(',', $paramValue);
+ } else {
+ return $defaultValue;
}
- return $defaultValue;
}
public function getPostData()
Re: svn commit: r676171 - in /incubator/shindig/trunk/php/src/socialrest: DataRequestHandler.php http/RestRequestItem.php
Posted by Ropu <ro...@gmail.com>.
chris, check these lines, something is not correct, u are always returning
the same, regardless the if()
ropu
--- incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
> (original)
> +++ incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php Sat
> Jul 12 05:53:54 2008
> @@ -139,26 +139,38 @@
>
> public function getStartIndex()
> {
> - $startIndex = $this->parameters[self::$START_INDEX];
> - return $startIndex == null ? self::$DEFAULT_START_INDEX :
> $startIndex;
> + if (!empty(self::$DEFAULT_START_INDEX)) {
> + return self::$DEFAULT_START_INDEX;
> + } else {
> + return self::$DEFAULT_START_INDEX;
> + }
> }
>
On Sat, Jul 12, 2008 at 9:53 AM, <ch...@apache.org> wrote:
> Author: chabotc
> Date: Sat Jul 12 05:53:54 2008
> New Revision: 676171
>
> URL: http://svn.apache.org/viewvc?rev=676171&view=rev
> Log:
> When will people learn to use isset / empty on array entries
>
> Modified:
> incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php
> incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
>
> Modified: incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php
> URL:
> http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php?rev=676171&r1=676170&r2=676171&view=diff
>
> ==============================================================================
> --- incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php
> (original)
> +++ incubator/shindig/trunk/php/src/socialrest/DataRequestHandler.php Sat
> Jul 12 05:53:54 2008
> @@ -29,7 +29,7 @@
> // Anonymous requests are only allowed to GET data
> (not create/edit/delete)
> $response = new ResponseItem(BAD_REQUEST, "", null);
> } elseif ($method == 'GET') {
> - $response = $this->handleGet($requestItem);
> + $response = $this->handleGet($requestItem);
> } elseif ($method == 'POST') {
> $response = $this->handlePost($requestItem);
> } elseif ($method == 'DELETE') {
>
> Modified:
> incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
> URL:
> http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php?rev=676171&r1=676170&r2=676171&view=diff
>
> ==============================================================================
> --- incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php
> (original)
> +++ incubator/shindig/trunk/php/src/socialrest/http/RestRequestItem.php Sat
> Jul 12 05:53:54 2008
> @@ -139,26 +139,38 @@
>
> public function getStartIndex()
> {
> - $startIndex = $this->parameters[self::$START_INDEX];
> - return $startIndex == null ? self::$DEFAULT_START_INDEX :
> $startIndex;
> + if (!empty(self::$DEFAULT_START_INDEX)) {
> + return self::$DEFAULT_START_INDEX;
> + } else {
> + return self::$DEFAULT_START_INDEX;
> + }
> }
>
> public function getCount()
> {
> - $count = $this->parameters[self::$COUNT];
> - return $count == null ? self::$DEFAULT_COUNT : $count;
> + if (!empty($this->parameters[self::$COUNT])) {
> + return $this->parameters[self::$COUNT];
> + } else {
> + return self::$DEFAULT_COUNT;
> + }
> }
>
> public function getOrderBy()
> {
> - $orderBy = $this->parameters[self::$ORDER_BY];
> - return $orderBy == null ? PeopleService::$sortOrder :
> $orderBy;
> + if (!empty($this->parameters[self::$ORDER_BY])) {
> + return $this->parameters[self::$ORDER_BY];
> + } else {
> + return PeopleService::$sortOrder;
> + }
> }
>
> public function getFilterBy()
> {
> - $filterBy = $this->parameters[self::$FILTER_BY];
> - return $filterBy == null ? PeopleService::$filterType :
> $filterBy;
> + if (!empty($this->parameters[self::$FILTER_BY])) {
> + return $this->parameters[self::$FILTER_BY];
> + } else {
> + return PeopleService::$filterType;
> + }
> }
>
> public function getFields()
> @@ -168,11 +180,12 @@
>
> public function getFieldsWithDefaultValue(Array $defaultValue)
> {
> - $paramValue = $this->parameters[self::$FIELDS];
> - if ($paramValue != null) {
> + if (!empty($this->parameters[self::$FIELDS])) {
> + $paramValue = $this->parameters[self::$FIELDS];
> return explode(',', $paramValue);
> + } else {
> + return $defaultValue;
> }
> - return $defaultValue;
> }
>
> public function getPostData()
>
>
>
--
.-. --- .--. ..-
R o p u