Skip to content

Commit

Permalink
Merge pull request #2 from vegas-cmf/v1.1
Browse files Browse the repository at this point in the history
V1.1
  • Loading branch information
krzysztof-kabala committed Feb 13, 2017
2 parents 1310ef7 + b71f54d commit 3626517
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
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

0 comments on commit 3626517

Please sign in to comment.