Skip to content
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

V1.1 #2

Merged
merged 15 commits into from
Feb 13, 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: php

php:
- 5.6
- 5.4

services:
- mongodb
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
"satooshi/php-coveralls": "dev-master",
"satooshi/php-coveralls": "^1.0",
"ext-mongo": ">=1.5"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Cli/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function toNamespace($str) {
$stringParts = preg_split('/_+/', $str);

foreach($stringParts as $key => $stringPart){
$stringParts[$key] = ucfirst(strtolower($stringPart));
$stringParts[$key] = \Phalcon\Text::camelize($stringPart);
}
return implode('\\', $stringParts) . '\\';
}
Expand Down
16 changes: 10 additions & 6 deletions src/DI/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* $this->serviceManager->getService('foo:barBaz');
* // or in view
* {{ serviceManager.getService('foo:barBaz') }}
* // or using extra params for __construct()
* {{ serviceManager.getService('foo:barBaz', ['param1', 'param2']) }}
* </code>
*
* @author Arkadiusz Ostrycharz <aostrycharz@amsterdam-standard.pl>
Expand All @@ -35,28 +37,30 @@ class ServiceManager implements InjectionAwareInterface
/**
* Alias for getService.
*
* @param $name
* @param string $name
* @param array $parameters
* @return object
*/
public function get($name)
public function get($name, array $parameters = [])
{
return $this->getService($name);
return $this->getService($name, $parameters);
}

/**
* Try to register and return service.
*
* @param $name
* @param string $name
* @param array $parameters
* @return object
* @throws Service\Exception
*/
public function getService($name)
public function getService($name, array $parameters = [])
{
try {
if (!$this->isRegisteredService($name)) {
$this->registerService($name);
}
return $this->di->get($name);
return $this->di->get($name, $parameters);
} catch (\Phalcon\DI\Exception $ex) {
throw new Exception($ex->getMessage().', using: '.$name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private function renderElement($page, $title, $class = '')

private function getUrlParams()
{
$arguments = $this->di->get('request')->get();
$arguments = $this->di->get('request')->getQuery();
unset($arguments['_url']);
unset($arguments['page']);

Expand Down
6 changes: 2 additions & 4 deletions src/Util/FileWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ class FileWriter
*/
public static function write($filePath, $content, $compareContents = false)
{
if ($compareContents) {
if (self::compareContents($filePath, $content)) {
return 0;
}
if ($compareContents && self::compareContents($filePath, $content)) {
return 0;
}

return file_put_contents($filePath, $content);
Expand Down
2 changes: 1 addition & 1 deletion tests/Tag/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class RequestMock
{
public function get()
public function getQuery()
{
return [
'by' => 'name',
Expand Down