Skip to content
Permalink
Browse files

Remove dead and unused code.

  • Loading branch information...
markstory committed Feb 11, 2014
1 parent 7a72431 commit a5d50da040225e764781b6524597069b131e81e1
@@ -329,7 +329,7 @@ protected function _find($command) {
$command = str_replace($this->badCommandChars, "", $command);
// Do we have a valid model?
list($modelToCheck, $tmp) = explode('->', $command);
list($modelToCheck) = explode('->', $command);
if ($this->_isValidModel($modelToCheck)) {
$findCommand = "\$data = \$this->$command;";
@@ -390,7 +390,7 @@ protected function _save($command) {
// Validate the model we're trying to save here
$command = strip_tags($command);
$command = str_replace($this->badCommandChars, "", $command);
list($modelToSave, $tmp) = explode("->", $command);
list($modelToSave) = explode("->", $command);
if ($this->_isValidModel($modelToSave)) {
// Extract the array of data we are trying to build
@@ -135,7 +135,6 @@ class CakeSession {
*/
public static function init($base = null) {
self::$time = time();
$checkAgent = Configure::read('Session.checkAgent');
if (env('HTTP_USER_AGENT')) {
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
@@ -669,7 +669,6 @@ public function column($real) {
}
$col = str_replace(')', '', $real);
$limit = null;
if (strpos($col, '(') !== false) {
list($col, $limit) = explode('(', $col);
@@ -250,9 +250,8 @@ public function column($real) {
}
$col = strtolower(str_replace(')', '', $real));
$limit = null;
if (strpos($col, '(') !== false) {
list($col, $limit) = explode('(', $col);
list($col) = explode('(', $col);
}
$standard = array(
@@ -2734,7 +2734,7 @@ public function order($keys, $direction = 'ASC', $model = null) {
if (is_object($model) && $model->isVirtualField($key)) {
$key = '(' . $this->_quoteFields($model->getVirtualField($key)) . ')';
}
list($alias, $field) = pluginSplit($key);
list($alias) = pluginSplit($key);
if (is_object($model) && $alias !== $model->alias && is_object($model->{$alias}) && $model->{$alias}->isVirtualField($key)) {
$key = '(' . $this->_quoteFields($model->{$alias}->getVirtualField($key)) . ')';
}
@@ -2832,7 +2832,7 @@ public function length($real) {
'int' => 1, 'tinyint' => 1, 'smallint' => 1, 'mediumint' => 1, 'integer' => 1, 'bigint' => 1
);
list($real, $type, $length, $offset, $sign, $zerofill) = $result;
list($real, $type, $length, $offset, $sign) = $result;
$typeArr = $type;
$type = $type[0];
$length = $length[0];
@@ -3241,13 +3241,12 @@ public function introspectType($value) {
}
$isAllFloat = $isAllInt = true;
$containsFloat = $containsInt = $containsString = false;
$containsInt = $containsString = false;
foreach ($value as $valElement) {
$valElement = trim($valElement);
if (!is_float($valElement) && !preg_match('/^[\d]+\.[\d]+$/', $valElement)) {
$isAllFloat = false;
} else {
$containsFloat = true;
continue;
}
if (!is_int($valElement) && !preg_match('/^[\d]+$/', $valElement)) {
@@ -196,9 +196,9 @@ public function testClear() {
Cache::config('file_test', array('engine' => 'File', 'duration' => 1));
$data = 'this is a test of the emergency broadcasting system';
$write = Cache::write('serialize_test1', $data, 'file_test');
$write = Cache::write('serialize_test2', $data, 'file_test');
$write = Cache::write('serialize_test3', $data, 'file_test');
Cache::write('serialize_test1', $data, 'file_test');
Cache::write('serialize_test2', $data, 'file_test');
Cache::write('serialize_test3', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
@@ -210,9 +210,9 @@ public function testClear() {
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
$data = 'this is a test of the emergency broadcasting system';
$write = Cache::write('serialize_test1', $data, 'file_test');
$write = Cache::write('serialize_test2', $data, 'file_test');
$write = Cache::write('serialize_test3', $data, 'file_test');
Cache::write('serialize_test1', $data, 'file_test');
Cache::write('serialize_test2', $data, 'file_test');
Cache::write('serialize_test3', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
@@ -413,23 +413,23 @@ public function testMaskSetting() {
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0666';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0644';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0640';
$this->assertEquals($expected, $result);
@@ -527,7 +527,7 @@ public function testUpdateWithTableCreate() {
$this->Shell->expects($this->any())
->method('in')
->will($this->returnValue('y'));
$r = $this->Shell->expects($this->once())
$this->Shell->expects($this->once())
->method('_run')
->with($this->arrayHasKey('newone'), 'update', $this->isInstanceOf('CakeSchema'));
@@ -427,9 +427,8 @@ public function testGenerateFixtureFile() {
$this->Task->expects($this->at(1))->method('createFile')
->with($filename, $this->stringContains('<?php'));
$result = $this->Task->generateFixtureFile('Article', array());
$result = $this->Task->generateFixtureFile('Article', array());
$this->Task->generateFixtureFile('Article', array());
$this->Task->generateFixtureFile('Article', array());
}
/**
@@ -609,7 +609,7 @@ public function testPaginateOrderModelDefault() {
$this->assertEmpty($result['order']);
$Controller->PaginatorControllerPost->order = 'PaginatorControllerPost.id';
$results = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
$result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
$this->assertEmpty($result['order']);
$Controller->PaginatorControllerPost->order = array(
@@ -1124,26 +1124,26 @@ public function testPaginateMaxLimit() {
$Controller->request->params['named'] = array(
'contain' => array('ControllerComment'), 'limit' => '1000'
);
$result = $Controller->paginate('PaginatorControllerPost');
$Controller->paginate('PaginatorControllerPost');
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
$Controller->request->params['named'] = array(
'contain' => array('ControllerComment'), 'limit' => '1000', 'maxLimit' => 1000
);
$result = $Controller->paginate('PaginatorControllerPost');
$Controller->paginate('PaginatorControllerPost');
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '10');
$result = $Controller->paginate('PaginatorControllerPost');
$Controller->paginate('PaginatorControllerPost');
$this->assertEquals(10, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '1000');
$Controller->paginate = array('maxLimit' => 2000, 'paramType' => 'named');
$result = $Controller->paginate('PaginatorControllerPost');
$Controller->paginate('PaginatorControllerPost');
$this->assertEquals(1000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '5000');
$result = $Controller->paginate('PaginatorControllerPost');
$Controller->paginate('PaginatorControllerPost');
$this->assertEquals(2000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
}
@@ -607,7 +607,7 @@ public function testValidatePostSimple() {
$fields = '69f493434187b867ea14b901fdf58b55d27c935d%3A';
$unlocked = '';
$this->Controller->request->data = $data = array(
$this->Controller->request->data = array(
'Model' => array('username' => '', 'password' => ''),
'_Token' => compact('key', 'fields', 'unlocked')
);
@@ -243,7 +243,6 @@ public function testMergeVarsNotGreedy() {
public function testMergeVarsModelClass() {
$Controller = new MergeVariablescontroller();
$Controller->uses = array('Test', 'TestAlias');
$lastModel = end($Controller->uses);
$Controller->constructClasses();
$this->assertEquals($Controller->uses[0], $Controller->modelClass);
}
@@ -2272,14 +2272,12 @@ public function testRequestRoute() {
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
// test that the first route is matched
$newUrl = array('controller' => 'products', 'action' => 'display', 6);
Router::connect('/government', $url);
Router::parse('/government');
$route = Router::requestRoute();
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
// test that an unmatched route does not change the current route
$newUrl = array('controller' => 'products', 'action' => 'display', 6);
Router::connect('/actor', $url);
Router::parse('/government');
$route = Router::requestRoute();
@@ -181,7 +181,7 @@ function coverage_toggle_all() {
*/
public function coverageHeader($filename, $percent) {
$filename = basename($filename);
list($file, $ext) = explode('.', $filename);
list($file) = explode('.', $filename);
$display = in_array($file, $this->_testNames) ? 'block' : 'none';
$primary = $display === 'block' ? 'primary' : '';
return <<<HTML
@@ -150,13 +150,10 @@ public function testCaseList() {
$plugin = $this->params['plugin'];
$buffer = "Core Test Cases:\n";
$urlExtra = '';
if ($app) {
$buffer = "App Test Cases:\n";
$urlExtra = '&app=true';
} elseif ($plugin) {
$buffer = Inflector::humanize($plugin) . " Test Cases:\n";
$urlExtra = '&plugin=' . $plugin;
}
if (count($testCases) < 1) {
@@ -536,9 +536,8 @@ protected static function _array(array $var, $depth, $indent) {
$var = $replace + $var;
$out = "array(";
$n = $break = $end = null;
$break = $end = null;
if (!empty($var)) {
$n = "\n";
$break = "\n" . str_repeat("\t", $indent);
$end = "\n" . str_repeat("\t", $indent - 1);
}
@@ -558,7 +558,7 @@ public function mime() {
if (!$finfo) {
return false;
}
list($type, $charset) = explode(';', $finfo);
list($type) = explode(';', $finfo);
return $type;
}
if (function_exists('mime_content_type')) {

0 comments on commit a5d50da

Please sign in to comment.
You can’t perform that action at this time.