Skip to content

Commit 031dbcf

Browse files
committed
Merge pull request #670 from phalcon/2.0.x
2.0.12
2 parents 30b0933 + d991ea1 commit 031dbcf

File tree

6 files changed

+71
-12
lines changed

6 files changed

+71
-12
lines changed

ide/stubs/Phalcon/Crypt.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,24 @@ public function getKey() {}
105105
/**
106106
* Pads texts before encryption
107107
*
108-
* @see http://www.di-mgt.com.au/cryptopad.html
108+
* @link http://www.di-mgt.com.au/cryptopad.html
109109
* @param string $text
110110
* @param string $mode
111111
* @param int $blockSize
112112
* @param int $paddingType
113+
* @return string
113114
*/
114115
protected function _cryptPadText($text, $mode, $blockSize, $paddingType) {}
115116

116117
/**
117-
* Removes padding @a padding_type from @a text
118-
* If the function detects that the text was not padded, it will return it unmodified
118+
* Removes $paddingType padding from text
119+
* If the method detects that the text was not padded, it will return it unmodified
119120
*
120121
* @param string $text Message to be unpadded
121122
* @param string $mode Encryption mode; unpadding is applied only in CBC or ECB mode
122123
* @param int $blockSize Cipher block size
123124
* @param int $paddingType Padding scheme
125+
* @return string
124126
*/
125127
protected function _cryptUnpadText($text, $mode, $blockSize, $paddingType) {}
126128

ide/stubs/Phalcon/Flash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function notice($message) {}
8484
* $flash->success('The process was finished successfully');
8585
* </code>
8686
*
87-
* @param string $message
87+
* @param mixed $message
8888
* @return string
8989
*/
9090
public function success($message) {}

ide/stubs/Phalcon/mvc/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public function assign($data, $dataColumnMap = null, $whiteList = null) {}
305305
* ));
306306
* </code>
307307
*
308-
* @param \Phalcon\Mvc\ModelInterface|Phalcon\Mvc\Model\Row $base
308+
* @param \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row $base
309309
* @param array $data
310310
* @param array $columnMap
311311
* @param int $dirtyState
@@ -605,7 +605,7 @@ public function validationHasFailed() {}
605605
* </code>
606606
*
607607
* @param mixed $filter
608-
* @return MessageInterface[]
608+
* @return \Phalcon\Mvc\Model\Message\MessageInterface[]
609609
*/
610610
public function getMessages($filter = null) {}
611611

ide/stubs/Phalcon/mvc/view/engine/Volt.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public function sort($value) {}
9797
*
9898
* @param string $name
9999
* @param array $arguments
100+
* @return mixed
100101
*/
101-
public function callMacro($name, $arguments) {}
102+
public function callMacro($name, $arguments = array()) {}
102103

103104
}

scripts/Phalcon/Builder/Module.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
namespace Phalcon\Builder;
2121

22+
use SplFileInfo;
23+
2224
/**
2325
* Module Builder
2426
*
@@ -88,7 +90,7 @@ public function build()
8890
$modulesDir = $this->path->getRootPath($modulesDir);
8991
}
9092

91-
$this->options->offsetSet('modulesDir', realpath($modulesDir));
93+
$this->options->offsetSet('modulesDir', $modulesDir);
9294
$this->options->offsetSet('templatePath', realpath($templatePath));
9395
$this->options->offsetSet('projectPath', $this->path->getRootPath());
9496

@@ -122,10 +124,39 @@ public function buildDirectories()
122124
));
123125
}
124126

125-
mkdir($modulesDir . DIRECTORY_SEPARATOR . $moduleName, 0777, true);
127+
$modulesPath = new SplFileInfo($modulesDir);
128+
$modulePath = $modulesDir. DIRECTORY_SEPARATOR . $moduleName;
129+
130+
try {
131+
if ($modulesPath->isFile() && !$modulesPath->isDir()) {
132+
throw new BuilderException(
133+
sprintf(
134+
"Builder expects a directory for 'modulesDir'. But %s is a file.",
135+
$modulesPath->getPathname()
136+
)
137+
);
138+
} elseif ($modulesPath->isReadable() && !mkdir($modulePath, 0777, true)) {
139+
throw new BuilderException("Unable to create module directory. Check permissions.");
140+
}
141+
142+
foreach ($this->moduleDirectories as $dir) {
143+
$path = $modulePath . DIRECTORY_SEPARATOR . $dir;
144+
if (!mkdir($path, 0777, true)) {
145+
throw new BuilderException(
146+
sprintf(
147+
"Unable to create %s directory. Check permissions.",
148+
$path
149+
)
150+
);
151+
}
152+
}
126153

127-
foreach ($this->moduleDirectories as $dir) {
128-
mkdir($modulesDir . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR . $dir, 0777, true);
154+
} catch (\Exception $e) {
155+
throw new BuilderException(
156+
$e->getMessage(),
157+
$e->getCode(),
158+
($e instanceof BuilderException ? null : $e)
159+
);
129160
}
130161

131162
return $this;

scripts/Phalcon/Utils.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ class Utils
2727
{
2828
const DB_ADAPTER_POSTGRESQL = 'Postgresql';
2929

30+
const DB_ADAPTER_SQLITE = 'Sqlite';
31+
32+
/**
33+
* Converts the underscore_notation to the UpperCamelCase
34+
*
35+
* @param string $string
36+
* @return string
37+
*/
3038
public static function camelize($string)
3139
{
3240
$stringParts = explode('_', $string);
@@ -35,6 +43,17 @@ public static function camelize($string)
3543
return implode('', $stringParts);
3644
}
3745

46+
/**
47+
* Converts the underscore_notation to the lowerCamelCase
48+
*
49+
* @param string $string
50+
* @return string
51+
*/
52+
public static function lowerCamelize($string)
53+
{
54+
return lcfirst(self::camelize($string));
55+
}
56+
3857
/**
3958
* Resolves the DB Schema
4059
*
@@ -48,7 +67,13 @@ public static function resolveDbSchema(Config $config)
4867
}
4968

5069
if (self::DB_ADAPTER_POSTGRESQL == $config->get('adapter')) {
51-
return 'public';
70+
return 'public';
71+
}
72+
73+
if (self::DB_ADAPTER_SQLITE == $config->get('adapter')) {
74+
// SQLite only supports the current database, unless one is
75+
// attached. This is not the case, so don't return a schema.
76+
return null;
5277
}
5378

5479
if ($config->offsetExists('dbname')) {

0 commit comments

Comments
 (0)