Skip to content

Commit

Permalink
PHP5.2対応
Browse files Browse the repository at this point in the history
  • Loading branch information
n1215 committed Mar 3, 2015
1 parent a407ce9 commit aeb174c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
14 changes: 7 additions & 7 deletions lib/Baser/Lib/BcAgent.php
Expand Up @@ -72,7 +72,7 @@ public static function find($name) {
if (!Configure::check($key)) {
return null;
}
return new static($name, Configure::read($key));
return new self($name, Configure::read($key));
}

/**
Expand All @@ -84,7 +84,7 @@ public static function findAll() {
$configs = Configure::read("BcAgent");
$agents = array();
foreach ($configs as $name => $config) {
$agents[] = new static($name, $config);
$agents[] = new self($name, $config);
}

return $agents;
Expand All @@ -97,7 +97,7 @@ public static function findAll() {
* @return BcAgent|null
*/
public static function findByAlias($alias) {
$agents = static::findAll();
$agents = self::findAll();

foreach ($agents as $agent) {
if ($agent->alias === $alias) {
Expand All @@ -114,7 +114,7 @@ public static function findByAlias($alias) {
* @return BcAgent|null
*/
public static function findByUrl(CakeRequest $request) {
$agents = static::findAll();
$agents = self::findAll();

foreach ($agents as $agent) {
if (preg_match('/^' . $agent->alias . '\//', $request->url)) {
Expand All @@ -130,7 +130,7 @@ public static function findByUrl(CakeRequest $request) {
* @return BcAgent|null
*/
public static function findCurrent() {
$agents = static::findAll();
$agents = self::findAll();

$userAgent = env('HTTP_USER_AGENT');
if (empty($userAgent)) {
Expand All @@ -157,7 +157,7 @@ public static function extractAlias($url) {
}

$params = explode('/', $url);
$agent = static::findByAlias($params[0]);
$agent = self::findByAlias($params[0]);

if (is_null($agent)) {
return null;
Expand Down Expand Up @@ -292,7 +292,7 @@ public function shouldRedirects(CakeRequest $request) {
*/
public function makeRedirectUrl(CakeRequest $request) {
$hereWithQuery = $request->here(false);
$alias = static::extractAlias($request->url);
$alias = self::extractAlias($request->url);

if (is_null($alias)) {
return "{$this->alias}{$hereWithQuery}";
Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/Plugin/Blog/Test/Case/BlogAllTest.php
Expand Up @@ -25,7 +25,7 @@ class BlogAllTest extends CakeTestSuite {
public static function suite() {
$suite = new CakeTestSuite('Baser Blog All Tests');

//$path = __DIR__ . DS;
//$path = dirname(__FILE__) . DS;
//$suite->addTestFile($path . 'BlogAllModelTest.php');

return $suite;
Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/Plugin/Feed/Test/Case/FeedAllModelTest.php
Expand Up @@ -20,7 +20,7 @@ class FeedAllModelTest extends CakeTestSuite {
*/
public static function suite() {
$suite = new CakeTestSuite('All Feed Model tests');
$suite->addTestDirectory(__DIR__ . DS . 'Model' . DS);
$suite->addTestDirectory(dirname(__FILE__) . DS . 'Model' . DS);
return $suite;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/Plugin/Feed/Test/Case/FeedAllTest.php
Expand Up @@ -25,7 +25,7 @@ class FeedAllTest extends CakeTestSuite {
public static function suite() {
$suite = new CakeTestSuite('Feed Plugin All Tests');

$path = __DIR__ . DS;
$path = dirname(__FILE__) . DS;

$suite->addTestFile($path . 'FeedAllModelTest.php');
return $suite;
Expand Down
5 changes: 3 additions & 2 deletions lib/Baser/Plugin/Mail/Test/Case/MailAllControllerTest.php
Expand Up @@ -20,8 +20,9 @@ class MailAllControllerTest extends CakeTestSuite {
*/
public static function suite() {
$suite = new CakeTestSuite('All Helper tests');
$suite->addTestDirectory(__DIR__ . DS . 'Controller' . DS);
$suite->addTestDirectory(__DIR__ . DS . 'Controller' . DS . 'Component' . DS);
$path = dirname(__FILE__) . DS;
$suite->addTestDirectory($path . 'Controller' . DS);
$suite->addTestDirectory($path . 'Controller' . DS . 'Component' . DS);
return $suite;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/Plugin/Mail/Test/Case/MailAllHelpersTest.php
Expand Up @@ -20,7 +20,7 @@ class MailAllHelpersTest extends CakeTestSuite {
*/
public static function suite() {
$suite = new CakeTestSuite('All Helper tests');
$suite->addTestDirectory(__DIR__ . DS . 'View' . DS . 'Helper' . DS);
$suite->addTestDirectory(dirname(__FILE__) . DS . 'View' . DS . 'Helper' . DS);
return $suite;
}

Expand Down
5 changes: 3 additions & 2 deletions lib/Baser/Plugin/Mail/Test/Case/MailAllModelTest.php
Expand Up @@ -20,8 +20,9 @@ class MailAllModelTest extends CakeTestSuite {
*/
public static function suite() {
$suite = new CakeTestSuite('All Helper tests');
$suite->addTestDirectory(__DIR__ . DS . 'Model' . DS);
$suite->addTestDirectory(__DIR__ . DS . 'Model' . DS . 'Behavior' . DS);
$path = dirname(__FILE__) . DS;
$suite->addTestDirectory($path . 'Model' . DS);
$suite->addTestDirectory($path . 'Model' . DS . 'Behavior' . DS);
return $suite;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Baser/Plugin/Mail/Test/Case/MailAllTest.php
Expand Up @@ -25,7 +25,7 @@ class MailAllTest extends CakeTestSuite {
public static function suite() {
$suite = new CakeTestSuite('Baser All Tests');

$path = __DIR__ . DS;
$path = dirname(__FILE__) . DS;

$suite->addTestFile($path . 'MailAllControllerTest.php');
$suite->addTestFile($path . 'MailAllModelTest.php');
Expand Down

0 comments on commit aeb174c

Please sign in to comment.