Passed
Pull Request — master (#8)
by Katsuhiro
02:20
created
classes/log/file.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 	public static function write($level, $msg, $method = null)
9 9
 	{
10 10
 		$log_threshold = \Config::get('log_threshold');
11
-		$config = \Config::get('log',array());
11
+		$config = \Config::get('log', array());
12 12
 
13
-		if( isset($config['drivers']['file']['log_threshold']))
13
+		if (isset($config['drivers']['file']['log_threshold']))
14 14
 		{
15 15
 			$log_threshold = $config['drivers']['file']['log_threshold'];
16 16
 		}
@@ -59,40 +59,40 @@  discard block
 block discarded – undo
59 59
 		if ( ! empty($method))
60 60
 		{
61 61
 			$call .= $method;
62
-		}else{
62
+		}else {
63 63
 			$backtrace = debug_backtrace();
64
-			$i=0;
65
-			for(;$i<count($backtrace);$i++){
64
+			$i = 0;
65
+			for (;$i < count($backtrace); $i++) {
66 66
 				$backtrace[$i]['object'] = null;
67 67
 				$break = false;
68 68
 
69
-				if(isset($backtrace[$i]['class'])){
70
-					if(!strstr($backtrace[$i]['class'],__NAMESPACE__)
71
-						and !strstr($backtrace[$i]['class'],'Fuel\Core\Log')) {
69
+				if (isset($backtrace[$i]['class'])) {
70
+					if ( ! strstr($backtrace[$i]['class'], __NAMESPACE__)
71
+						and ! strstr($backtrace[$i]['class'], 'Fuel\Core\Log')) {
72 72
 	
73 73
 						//
74
-						if($level === 'Error'){
74
+						if ($level === 'Error') {
75 75
 							if ($level == 'Error') var_dump($backtrace);
76 76
 						}
77 77
 						$break = true;
78 78
 					}
79 79
 				}
80 80
 
81
-				if($break){
81
+				if ($break) {
82 82
 					break;
83 83
 				}
84 84
 			}
85
-			if(isset($backtrace[$i])){
86
-				$call .= isset($backtrace[$i]['class'])    ? $backtrace[$i]['class']      : ' - ';
87
-				$call .= isset($backtrace[$i]['type'])     ? $backtrace[$i]['type']       : ' - ';
88
-				$call .= isset($backtrace[$i]['function']) ? $backtrace[$i]['function']   : ' - ';
89
-				$call .= isset($backtrace[$i-1]['line'])   ? ':'.$backtrace[$i-1]['line'] : ' - ';
85
+			if (isset($backtrace[$i])) {
86
+				$call .= isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : ' - ';
87
+				$call .= isset($backtrace[$i]['type']) ? $backtrace[$i]['type'] : ' - ';
88
+				$call .= isset($backtrace[$i]['function']) ? $backtrace[$i]['function'] : ' - ';
89
+				$call .= isset($backtrace[$i-1]['line']) ? ':'.$backtrace[$i-1]['line'] : ' - ';
90 90
 			}
91 91
 		}
92 92
 
93 93
 		$message .= $level.' '.(($level == 'info') ? ' -' : '-').' ';
94 94
 		$message .= date(\Config::get('log_date_format'));
95
-		$message .= ' - ' . 'ouid=' . parent::$opensocial_user_id;
95
+		$message .= ' - '.'ouid='.parent::$opensocial_user_id;
96 96
 		$message .= ' --> '.(empty($call) ? '' : $call.' - ').$msg.PHP_EOL;
97 97
 
98 98
 		flock($fp, LOCK_EX);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		if ( ! empty($method))
60 60
 		{
61 61
 			$call .= $method;
62
-		}else{
62
+		} else{
63 63
 			$backtrace = debug_backtrace();
64 64
 			$i=0;
65 65
 			for(;$i<count($backtrace);$i++){
@@ -72,9 +72,11 @@  discard block
 block discarded – undo
72 72
 	
73 73
 						//
74 74
 						if($level === 'Error'){
75
-							if ($level == 'Error') #var_dump($backtrace);
75
+							if ($level == 'Error') {
76
+								#var_dump($backtrace);
76 77
 						}
77 78
 						$break = true;
79
+							}
78 80
 					}
79 81
 				}
80 82
 
Please login to merge, or discard this patch.
classes/log/td.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 		{
55 55
 			//$call .= $method;
56 56
 			$call['method'] = $method;
57
-		}else{
57
+		} else{
58 58
 			$backtrace = debug_backtrace();
59 59
 			$i=0;
60 60
 			for(;$i<count($backtrace);$i++){
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -39,58 +39,58 @@
 block discarded – undo
39 39
 			\Console::log($method.' - '.$msg);
40 40
 		}
41 41
 
42
-		$host     = empty($config['drivers']['td']['host'])     ? null      : $config['drivers']['td']['host'];
43
-		$port     = empty($config['drivers']['td']['port'])     ? null      : $config['drivers']['td']['port'];
44
-		$options  = empty($config['drivers']['td']['options'])  ? array()   : $config['drivers']['td']['options'];
45
-		$packer   = empty($config['drivers']['td']['packer'])   ? null      : $config['drivers']['td']['packer'];
42
+		$host     = empty($config['drivers']['td']['host']) ? null : $config['drivers']['td']['host'];
43
+		$port     = empty($config['drivers']['td']['port']) ? null : $config['drivers']['td']['port'];
44
+		$options  = empty($config['drivers']['td']['options']) ? array() : $config['drivers']['td']['options'];
45
+		$packer   = empty($config['drivers']['td']['packer']) ? null : $config['drivers']['td']['packer'];
46 46
 		$database = empty($config['drivers']['td']['database']) ? 'default' : $config['drivers']['td']['database'];
47 47
 
48
-		$logger = new \Fluent\Logger\FluentLogger($host,$port,$options,$packer);
48
+		$logger = new \Fluent\Logger\FluentLogger($host, $port, $options, $packer);
49 49
 
50
-		$message  = array();
50
+		$message = array();
51 51
 
52 52
 		$call = array();
53 53
 		if ( ! empty($method))
54 54
 		{
55 55
 			$call['method'] = $method;
56
-		}else{
56
+		}else {
57 57
 			$backtrace = debug_backtrace();
58
-			$i=0;
59
-			for(;$i<count($backtrace);$i++){
58
+			$i = 0;
59
+			for (;$i < count($backtrace); $i++) {
60 60
 				$backtrace[$i]['object'] = null;
61 61
 				$break = false;
62 62
 
63
-				if(isset($backtrace[$i]['class'])){
64
-					if(!strstr($backtrace[$i]['class'],__NAMESPACE__)
65
-						and !strstr($backtrace[$i]['class'],'Fuel\Core\Log')) {
63
+				if (isset($backtrace[$i]['class'])) {
64
+					if ( ! strstr($backtrace[$i]['class'], __NAMESPACE__)
65
+						and ! strstr($backtrace[$i]['class'], 'Fuel\Core\Log')) {
66 66
 	
67 67
 						//
68
-						if($level === 'Error'){
69
-							$msg = print_r($backtrace,true);
68
+						if ($level === 'Error') {
69
+							$msg = print_r($backtrace, true);
70 70
 						}
71 71
 						$break = true;
72 72
 					}
73 73
 				}
74 74
 
75
-				if($break){
75
+				if ($break) {
76 76
 					break;
77 77
 				}
78 78
 			}
79
-			if(isset($backtrace[$i])){
80
-				$call['class']    = isset($backtrace[$i]['class'])    ? $backtrace[$i]['class']    : 'null';
81
-				$call['type']     = isset($backtrace[$i]['type'])     ? $backtrace[$i]['type']     : 'null';
79
+			if (isset($backtrace[$i])) {
80
+				$call['class']    = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : 'null';
81
+				$call['type']     = isset($backtrace[$i]['type']) ? $backtrace[$i]['type'] : 'null';
82 82
 				$call['function'] = isset($backtrace[$i]['function']) ? $backtrace[$i]['function'] : 'null';
83
-				$call['line']     = isset($backtrace[$i-1]['line'])   ? $backtrace[$i-1]['line']   : 'null';
83
+				$call['line']     = isset($backtrace[$i-1]['line']) ? $backtrace[$i-1]['line'] : 'null';
84 84
 			}
85 85
 		}
86 86
 
87 87
 		$message['level'] = $level;
88 88
 		$message['date']  = date(\Config::get('log_date_format'));
89 89
 		$message['msg']   = $msg;
90
-	   	$message['call']  = $call;
90
+	   	$message['call'] = $call;
91 91
 
92
-		$res = $logger->post('td.'.$database.'.fuel_log',$message);
93
-		if(!$res){
92
+		$res = $logger->post('td.'.$database.'.fuel_log', $message);
93
+		if ( ! $res) {
94 94
 			return false;
95 95
 		}
96 96
 
Please login to merge, or discard this patch.
classes/log/copy.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 
3 3
 namespace Fluentd\Log;
4 4
 
5
-class Copy extends \Fluentd\Log{
5
+class Copy extends \Fluentd\Log {
6 6
 
7
-	public static function write($level, $msg, $method = null){
7
+	public static function write($level, $msg, $method = null) {
8 8
 		$log_config = \Config::get('log');
9 9
 
10 10
 		$return = false;
11
-		if(array_key_exists('copy',$log_config['drivers'])){
12
-			foreach( $log_config['drivers']['copy'] as $driver){
13
-				$class = __NAMESPACE__ .'\\'. ucfirst($driver);
11
+		if (array_key_exists('copy', $log_config['drivers'])) {
12
+			foreach ($log_config['drivers']['copy'] as $driver) {
13
+				$class = __NAMESPACE__.'\\'.ucfirst($driver);
14 14
 
15
-				try{
16
-					$return = $class::write($level,$msg,$method);
15
+				try {
16
+					$return = $class::write($level, $msg, $method);
17 17
 				} catch (FuelException $e) {
18 18
 					//
19 19
 				}
Please login to merge, or discard this patch.
classes/observer/td.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@
 block discarded – undo
17 17
 	{
18 18
 
19 19
 		$save_data = array();
20
-		foreach(array_keys($obj->properties()) as $p){
20
+		foreach (array_keys($obj->properties()) as $p) {
21 21
 			$save_data[$p] = $obj->{$p};
22 22
 		}
23 23
 
24
-		$host     = empty(self::$td_config['host'])     ? null      : self::$td_config['host'];
25
-		$port     = empty(self::$td_config['port'])     ? null      : self::$td_config['port'];
26
-		$options  = empty(self::$td_config['options'])  ? array()   : self::$td_config['options'];
27
-		$packer   = empty(self::$td_config['packer'])   ? null      : self::$td_config['packer'];
24
+		$host     = empty(self::$td_config['host']) ? null : self::$td_config['host'];
25
+		$port     = empty(self::$td_config['port']) ? null : self::$td_config['port'];
26
+		$options  = empty(self::$td_config['options']) ? array() : self::$td_config['options'];
27
+		$packer   = empty(self::$td_config['packer']) ? null : self::$td_config['packer'];
28 28
 		$database = empty(self::$td_config['database']) ? 'default' : self::$td_config['database'];
29 29
 		$table_name = $obj->table();
30 30
 
31 31
 		\Fluent\Autoloader::register();
32
-		$logger = new \Fluent\Logger\FluentLogger($host,$port,$options,$packer);
33
-		$res = $logger->post('td.'.$database.'.'.$table_name,$save_data);
32
+		$logger = new \Fluent\Logger\FluentLogger($host, $port, $options, $packer);
33
+		$res = $logger->post('td.'.$database.'.'.$table_name, $save_data);
34 34
 
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
config/observer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php 
2
-$observer_conf =  array(
2
+$observer_conf = array(
3 3
 	'td' => array(
4 4
 		'database' => 'default',
5 5
 		//'host' => 'unix:///var/run/td-agent/td-agent.sock',
Please login to merge, or discard this patch.
config/log.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php 
2
-$log_conf =  array(
2
+$log_conf = array(
3 3
 	'driver' => 'file',
4 4
 
5 5
 	'drivers' => array(
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 				'log_threshold'    => Fuel::L_INFO,
8 8
 				'log_path' => DOCROOT.'../logs/',
9 9
 				),
10
-		'copy' => array('file','td'),
10
+		'copy' => array('file', 'td'),
11 11
 		'td' => array(
12 12
 			'log_threshold'    => Fuel::L_INFO,
13 13
 			'database' => 'default',
Please login to merge, or discard this patch.