Skip to content

Commit

Permalink
cs fixes for url add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
ehough committed Apr 26, 2016
1 parent d6927f9 commit 4c9ec17
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 291 deletions.
129 changes: 21 additions & 108 deletions src/add-ons/url/classes/tubepress/url/impl/puzzle/PuzzleBasedQuery.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/**
/*
* Copyright 2006 - 2016 TubePress LLC (http://tubepress.com)
*
* This file is part of TubePress (http://tubepress.com)
Expand All @@ -8,7 +8,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

class tubepress_url_impl_puzzle_PuzzleBasedQuery implements tubepress_api_url_QueryInterface
{
/**
Expand All @@ -27,14 +26,7 @@ public function __construct(puzzle_Query $delegate)
}

/**
* Add a value to a key. If a key of the same name has already been added,
* the key value will be converted into an array and the new value will be
* pushed to the end of the array.
*
* @param string $key Key to add
* @param mixed $value Value to add to the key
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function add($key, $value)
{
Expand All @@ -46,9 +38,7 @@ public function add($key, $value)
}

/**
* Removes all key value pairs
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function clear()
{
Expand All @@ -60,97 +50,55 @@ public function clear()
}

/**
* Iterates over each key value pair in the collection passing them to the
* callable. If the callable returns true, the current value from input is
* returned into the result tubepress_api_url_QueryInterface.
*
* The callable must accept two arguments:
* - (string) $key
* - (string) $value
*
* @param callable $closure Evaluation function
*
* @return tubepress_api_url_QueryInterface
* {@inheritdoc}
*/
public function filter($closure)
{
return $this->_delegate->filter($closure);
}

/**
* Get a specific key value.
*
* @param string $key Key to retrieve.
*
* @return mixed|null Value of the key or NULL
* {@inheritdoc}
*/
public function get($key)
{
return $this->_delegate->get($key);
}

/**
* Get all keys in the collection
*
* @return array
* {@inheritdoc}
*/
public function getKeys()
{
return $this->_delegate->getKeys();
}

/**
* Returns whether or not the specified key is present.
*
* @param string $key The key for which to check the existence.
*
* @return bool
* {@inheritdoc}
*/
public function hasKey($key)
{
return $this->_delegate->hasKey($key);
}

/**
* Checks if any keys contains a certain value
*
* @param string $value Value to search for
*
* @return mixed Returns the key if the value was found FALSE if the value
* was not found.
* {@inheritdoc}
*/
public function hasValue($value)
{
return $this->_delegate->hasValue($value);
}

/**
* Returns a tubepress_api_url_QueryInterface containing all the elements of the collection after
* applying the callback function to each one.
*
* The callable should accept three arguments:
* - (string) $key
* - (string) $value
* - (array) $context
*
* The callable must return a the altered or unaltered value.
*
* @param callable $closure Map function to apply
* @param array $context Context to pass to the callable
*
* @return tubepress_api_url_QueryInterface
* {@inheritdoc}
*/
public function map($closure, array $context = array())
{
return $this->_delegate->map($closure, $context);
}

/**
* Add and merge in a tubepress_api_url_QueryInterface or array of key value pair data.
*
* @param tubepress_api_url_QueryInterface|array $data Associative array of key value pair data
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function merge($data)
{
Expand All @@ -167,12 +115,7 @@ public function merge($data)
}

/**
* Over write key value pairs in this collection with all of the data from
* an array or collection.
*
* @param array|Traversable $data Values to override over this config
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function overwriteWith($data)
{
Expand All @@ -184,11 +127,7 @@ public function overwriteWith($data)
}

/**
* Remove a specific key value pair
*
* @param string $key A key to remove
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function remove($key)
{
Expand All @@ -200,11 +139,7 @@ public function remove($key)
}

/**
* Replace the data of the object with the value of an array
*
* @param array $data Associative array of data
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function replace(array $data)
{
Expand All @@ -216,12 +151,7 @@ public function replace(array $data)
}

/**
* Set a key value pair
*
* @param string $key Key to set
* @param mixed $value Value to set
*
* @return tubepress_api_url_QueryInterface Self.
* {@inheritdoc}
*/
public function set($key, $value)
{
Expand All @@ -233,12 +163,7 @@ public function set($key, $value)
}

/**
* Specify how values are URL encoded
*
* @param string|bool $type One of 'RFC1738', 'RFC3986', or false to disable encoding
*
* @return tubepress_api_url_QueryInterface Self.
* @throws InvalidArgumentException
* {@inheritdoc}
*/
public function setEncodingType($type)
{
Expand All @@ -250,51 +175,39 @@ public function setEncodingType($type)
}

/**
* @return array This query as an associative array.
* {@inheritdoc}
*/
public function toArray()
{
return $this->_delegate->toArray();
}

/**
* Convert the query string parameters to a query string string
*
* @return string
* {@inheritdoc}
*/
public function toString()
{
return $this->__toString();
}

/**
* Alias of toString()
*
* @return string
* {@inheritdoc}
*/
public function __toString()
{
return $this->_delegate->__toString();
}

/**
* Prevent any modifications to this query.
*
* @return void
*
* @api
* @since 4.0.0
* {@inheritdoc}
*/
public function freeze()
{
$this->_isFrozen = true;
}

/**
* @return bool True if this query is frozen, false otherwise.
*
* @api
* @since 4.0.0
* {@inheritdoc}
*/
public function isFrozen()
{
Expand All @@ -308,4 +221,4 @@ private function _assertNotFrozen()
throw new BadMethodCallException('Query is frozen');
}
}
}
}
Loading

0 comments on commit 4c9ec17

Please sign in to comment.