Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleaned up syntax

  • Loading branch information...
commit b746e262d6d237851774469694f9035163fa0450 1 parent a31cadb
@cgarvis cgarvis authored
View
2  action/Response.php
@@ -8,8 +8,6 @@
namespace lithium\action;
-use BadMethodCallException;
-
/**
* A `Response` object is typically instantiated automatically by the `Controller`. It is assigned
* any headers set in the course of the request, as well as any content rendered by the
View
15 data/source/Http.php
@@ -101,14 +101,14 @@ public function __get($property) {
}
/**
- * Pass methods to service connection. Path and method are determined from Http::$_method. If not
- * set, a GET request with the $method as the path will be used.
+ * Pass methods to service connection. Path and method are determined from Http::$_method. If
+ * not set, a GET request with the $method as the path will be used.
*
+ * @see lithium\data\source\Http::$_method
* @param string $method
* @param array $params
* @return mixed
* @filter
- * @see lithium\data\source\Http::$_method
*/
public function __call($method, $params) {
$params += array(array(), array());
@@ -120,20 +120,21 @@ public function __call($method, $params) {
}
if (!isset($string['path'])) {
- $string['path'] = '/'.$method;
+ $string['path'] = '/' . $method;
}
$conn =& $this->connection;
$filter = function($self, $params) use (&$conn, $string) {
list($query, $options) = $params;
- if(is_object($query)) {
+ if (is_object($query)) {
$options += array_filter($query->export($self), function($v) {
return $v !== null;
});
$data = $query->data();
} else {
- $data = in_array($string['method'], array('post', 'put')) ? (array) $query : array();
+ $data = in_array($string['method'], array('post', 'put')) ?
+ (array) $query : array();
}
preg_match_all('/\{:(\w+)\}/', $string['path'], $matches);
@@ -279,4 +280,4 @@ public function name($name) {
}
}
-?>
+?>
View
4 net/http/Media.php
@@ -249,7 +249,7 @@ public static function type($type, $content = null, array $options = array()) {
return compact('content') + array('options' => static::_handlers($type));
}
if ($content) {
- static::$_types[$type] = (array)$content;
+ static::$_types[$type] = (array) $content;
}
static::$_handlers[$type] = $options ? Set::merge($defaults, $options) : array();
}
@@ -867,4 +867,4 @@ protected static function _assets($type = null) {
}
}
-?>
+?>
View
10 net/http/Request.php
@@ -98,10 +98,10 @@ public function __construct(array $config = array()) {
*/
protected function _encode($body) {
$media = $this->_classes['media'];
- if($type = $media::type($this->_type)) {
+ if ($type = $media::type($this->_type)) {
$body = $media::encode($this->_type, $body) ?: $body;
}
- if(is_array($body)) {
+ if (is_array($body)) {
$body = join("\r\n", $body);
}
return $body;
@@ -240,9 +240,9 @@ public function to($format, array $options = array()) {
$this->headers('Authorization', "Basic {$auth}");
}
}
- if(in_array($options['method'], array('POST', 'PUT'))) {
+ if (in_array($options['method'], array('POST', 'PUT'))) {
$media = $this->_classes['media'];
- if($type = $media::type($this->_type)) {
+ if ($type = $media::type($this->_type)) {
$this->headers('Content-Type', $type['content'][0]);
}
}
@@ -284,4 +284,4 @@ public function __toString() {
}
}
-?>
+?>
View
4 net/http/Response.php
@@ -128,7 +128,7 @@ protected function _init() {
*/
protected function _decode($body) {
$media = $this->_classes['media'];
- if($type = $media::type($this->_type)) {
+ if ($type = $media::type($this->_type)) {
$body = $media::decode($this->_type, $body) ?: $body;
}
return $body;
@@ -252,4 +252,4 @@ public function __toString() {
}
}
-?>
+?>
View
2  net/http/Service.php
@@ -222,4 +222,4 @@ protected function _request($method, $path, $data, $options) {
}
}
-?>
+?>
View
2  net/socket/Curl.php
@@ -197,4 +197,4 @@ public function set($flags, $value = null) {
}
}
-?>
+?>
View
2  storage/session/strategy/Encrypt.php
@@ -267,4 +267,4 @@ protected static function _vectorSize() {
}
}
-?>
+?>
View
6 template/helper/Html.php
@@ -126,9 +126,9 @@ public function charset($encoding = null) {
*
* @param string $title The content to be wrapped by an `<a />` tag.
* @param mixed $url Can be a string representing a URL relative to the base of your Lithium
- * application, an external URL (starts with `'http://'` or `'https://'`), an anchor
- * name starting with `'#'` (i.e. `'#top'`), or an array defining a set of request
- * parameters that should be matched against a route in `Router`.
+ * application, an external URL (starts with `'http://'` or `'https://'`), an
+ * anchor name starting with `'#'` (i.e. `'#top'`), or an array defining a set
+ * of request parameters that should be matched against a route in `Router`.
* @param array $options Array of HTML s and other options.
* @return string Returns an `<a />` or `<link />` element.
*/
View
2  tests/cases/action/ControllerTest.php
@@ -374,4 +374,4 @@ public function testNonExistentFunction() {
}
}
-?>
+?>
View
8 tests/cases/console/command/RouteTest.php
@@ -206,7 +206,7 @@ public function testShowWithInvalidRoute() {
);
$command = new Route(compact('request') + array(
'routes' => $this->_config['routes'],
- 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
+ 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
));
$command->show();
@@ -222,7 +222,7 @@ public function testShowWithValidRoute() {
$request->params = array('args' => array('/'));
$command = new Route(compact('request') + array(
'routes' => $this->_config['routes'],
- 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
+ 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
));
$command->show();
@@ -241,7 +241,7 @@ public function testShowWithEnvironment() {
);
$command = new Route(compact('request') + array(
'routes' => $this->_config['routes'],
- 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
+ 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
));
$command->show();
@@ -262,7 +262,7 @@ public function testShowWithHttpMethod() {
);
$command = new Route(compact('request') + array(
'routes' => $this->_config['routes'],
- 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
+ 'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
));
$command->show();
View
1  tests/cases/data/ModelTest.php
@@ -9,7 +9,6 @@
namespace lithium\tests\cases\data;
use lithium\data\Model;
-use lithium\data\Entity;
use lithium\data\model\Query;
use lithium\data\Connections;
use lithium\data\entity\Record;
View
2  tests/cases/data/source/HttpTest.php
@@ -321,4 +321,4 @@ public function testCustomPostMethodWithModel() {
}
}
-?>
+?>
View
7 tests/cases/net/http/MediaTest.php
@@ -51,7 +51,10 @@ public function testMediaTypes() {
$this->assertEqual($expected, $result['options']);
// Add a custom media type with a custom view class:
- Media::type('my', 'text/x-my', array('view' => 'my\custom\View', 'paths' => array('layout' => false)));
+ Media::type('my', 'text/x-my', array(
+ 'view' => 'my\custom\View',
+ 'paths' => array('layout' => false)
+ ));
$result = Media::types();
$this->assertTrue(in_array('my', $result));
@@ -625,4 +628,4 @@ public function testContentNegotiationByUserAgent() {
}
}
-?>
+?>
View
2  tests/cases/net/socket/CurlTest.php
@@ -155,4 +155,4 @@ public function testSendPostThenGet() {
}
}
-?>
+?>
View
18 tests/cases/template/helper/FormTest.php
@@ -467,18 +467,24 @@ public function testCustomValueCheckbox() {
public function testRadioGeneration() {
$result = $this->form->radio('foo');
- $this->assertTags($result, array(
- array('input' => array('type' => 'radio', 'value' => '1', 'name' => 'foo', 'id' => 'Foo'))
+ $this->assertTags($result, array(array(
+ 'input' => array('type' => 'radio', 'value' => '1', 'name' => 'foo', 'id' => 'Foo'))
));
$result = $this->form->radio('foo', array('checked' => false));
- $this->assertTags($result, array(
- array('input' => array('type' => 'radio', 'value' => '1', 'name' => 'foo', 'id' => 'Foo'))
+ $this->assertTags($result, array(array(
+ 'input' => array('type' => 'radio', 'value' => '1', 'name' => 'foo', 'id' => 'Foo'))
));
$result = $this->form->radio('foo', array('checked' => true));
- $this->assertTags($result, array(
- array('input' => array('type' => 'radio', 'value' => '1', 'name' => 'foo', 'checked' => 'checked', 'id' => 'Foo'))
+ $this->assertTags($result, array(array(
+ 'input' => array(
+ 'type' => 'radio',
+ 'value' => '1',
+ 'name' => 'foo',
+ 'checked' => 'checked',
+ 'id' => 'Foo')
+ )
));
$record = new Record(array('model' => $this->_model, 'data' => array('foo' => true)));
View
2  tests/integration/data/CrudTest.php
@@ -162,7 +162,7 @@ public function testUpdateWithNewProperties() {
protected static function _createCompany() {
Companies::create(array(
'name' => 'Acme, Inc.',
- 'active' => true,
+ 'active' => true
))->save();
}
}
View
1  tests/integration/data/SourceTest.php
@@ -8,7 +8,6 @@
namespace lithium\tests\integration\data;
-use Exception;
use lithium\data\Connections;
use lithium\tests\mocks\data\Companies;
use lithium\tests\mocks\data\Employees;
View
5 tests/integration/net/http/MediaTest.php
@@ -8,7 +8,6 @@
namespace lithium\tests\integration\net\http;
-use lithium\template\View;
use lithium\net\http\Media;
use lithium\net\http\Response;
@@ -27,7 +26,7 @@ public function testMediaTypeViewRender() {
'layout' => false,
'template' => array(
'{:library}/tests/mocks/template/view/adapters/{:template}.{:type}.php',
- '{:library}/tests/mocks/template/view/adapters/{:template}.html.php',
+ '{:library}/tests/mocks/template/view/adapters/{:template}.html.php'
)
)
));
@@ -59,7 +58,7 @@ public function testMediaTypeViewRender() {
'layout' => '{:library}/tests/mocks/template/view/adapters/testLayoutFile.html.php',
'template' => array(
'{:library}/tests/mocks/template/view/adapters/{:template}.{:type}.php',
- '{:library}/tests/mocks/template/view/adapters/{:template}.html.php',
+ '{:library}/tests/mocks/template/view/adapters/{:template}.html.php'
)
)
));
View
4 tests/mocks/data/MockCompanies.php
@@ -6,12 +6,12 @@ class MockCompanies extends \lithium\data\Model {
public $hasMany = array(
'Employees' => array(
'key' => array('id' => 'company_id'),
- 'to' => 'lithium\\tests\\mocks\\data\\MockEmployees',
+ 'to' => 'lithium\\tests\\mocks\\data\\MockEmployees'
)
);
protected $_meta = array(
'source' => 'companies',
- 'connection' => 'lithium_mysql_test',
+ 'connection' => 'lithium_mysql_test'
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.