Skip to content

Commit 703940f

Browse files
committed
Codeclimate change
1 parent 133008a commit 703940f

File tree

3 files changed

+27
-58
lines changed

3 files changed

+27
-58
lines changed

.codeclimate.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ engines:
33
enabled: true
44
config:
55
languages:
6-
- ruby
76
- javascript
8-
- python
97
- php
108
fixme:
119
enabled: true
@@ -16,13 +14,8 @@ engines:
1614
enabled: false
1715
ratings:
1816
paths:
19-
- "**.inc"
2017
- "**.js"
21-
- "**.jsx"
22-
- "**.module"
2318
- "**.php"
24-
- "**.py"
25-
- "**.rb"
2619
exclude_paths:
2720
- git/**/*
2821
- examples/**/*

dist/jate/functions/array.php

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<?php
22
function utf8ize($_array) {
3-
if (is_array($_array)) {
4-
foreach ($_array as $k => $v) {
5-
$_array[$k] = utf8ize($v);
6-
}
7-
} else if (is_string ($_array)) {
8-
return utf8_encode($_array);
9-
}
10-
return $_array;
3+
return travelStringArray($_array,"utf8_encode");
114
}
125
function unutf8ize($_array) {
6+
return travelStringArray($_array,"utf8_decode");
7+
}
8+
function arraySlash($_array) {
9+
return travelStringArray($_array,"addslashes");
10+
}
11+
function travelStringArray ( $_array, $_function ) {
1312
if (is_array($_array)) {
1413
foreach ($_array as $k => $v) {
15-
$_array[$k] = unutf8ize($v);
14+
$_array[$k] = travelStringArray($v, $_function);
1615
}
1716
} else if (is_string ($_array)) {
18-
return utf8_decode($_array);
17+
return call_user_func($_function,$_array);
1918
}
2019
return $_array;
2120
}
@@ -31,14 +30,4 @@ function array_depth( $_array ) {
3130
}
3231
return $max_depth;
3332
}
34-
function array_slash($_array) {
35-
if (is_array($_array)) {
36-
foreach ($_array as $k => $v) {
37-
$_array[$k] = array_slash($v);
38-
}
39-
} else if (is_string ($_array)) {
40-
return addslashes($_array);
41-
}
42-
return $_array;
43-
}
4433
?>

dist/jate/functions/folder.php

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,45 @@
11
<?php
22
function subFolder( $_dir = "./" ) {
3-
$temp = array();
4-
if (is_dir($_dir)) {
5-
if ($dirOpened = opendir($_dir)) {
6-
while (($file = readdir($dirOpened)) !== false) {
7-
if( ($file !='.')&&($file !='..') ) {
8-
array_push($temp,$file);
9-
}
10-
}
11-
closedir($dirOpened);
12-
}
13-
}
3+
$temp = fetchInSubFolder($_dir, function( $_file ) {
4+
return true;
5+
});
146
return $temp;
157
}
168
function subFolder_file( $_dir = "./" ) {
17-
$temp = array();
18-
if (is_dir($_dir)) {
19-
if ($dirOpened = opendir($_dir)) {
20-
while (($file = readdir($dirOpened)) !== false) {
21-
if( ($file !='.') && ($file !='..') && !is_dir($file) ) {
22-
array_push($temp,$file);
23-
}
24-
}
25-
closedir($dirOpened);
26-
}
27-
}
9+
$temp = fetchInSubFolder($_dir, function( $_file ) {
10+
return !is_dir($_file);
11+
});
2812
return $temp;
2913
}
3014
function subFolder_dir( $_dir = "./" ) {
15+
$temp = fetchInSubFolder($_dir, function( $_file ) {
16+
return !is_file($_file);
17+
});
18+
return $temp;
19+
}
20+
function fetchInSubFolder( $_dir = "./", $_function) {
3121
$temp = array();
3222
if (is_dir($_dir)) {
3323
if ($dirOpened = opendir($_dir)) {
34-
while (($file = readdir($dirOpened)) !== false) {
35-
if( ($file !='.') && ($file !='..') && !is_file($file) ) {
36-
array_push($temp,$file);
37-
}
38-
}
24+
while (($file = readdir($dirOpened)) !== false)
25+
if( ($file !='.')&&($file !='..') )
26+
if($_function($file))
27+
array_push($temp,$file);
3928
closedir($dirOpened);
4029
}
4130
}
4231
return $temp;
4332
}
4433
function require_subfolder( $_dir = "./" ) {
4534
$temp = subFolder_file($_dir);
46-
foreach ($temp as $i) {
35+
foreach ($temp as $i)
4736
require_once($_dir."/".$i);
48-
}
4937
}
5038
function require_js( $_dir = "./" ) {
5139
$tempArray = array();
5240
$temp = subFolder_file($_dir);
53-
foreach ($temp as $i) {
41+
foreach ($temp as $i)
5442
array_push($tempArray, $_dir."/".$i);
55-
}
5643
return $tempArray;
5744
}
5845
?>

0 commit comments

Comments
 (0)