From 2c66a07457edc1ee67d05231cdb641de636a5fa2 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 18 Nov 2025 14:18:03 +0800 Subject: [PATCH] * [misc] Move the open curly brace to the beginning of next line. --- lib/base/delegate/delegate.class.php | 36 ++++++++++++++++++---------- lib/phpexcel/phpexcel.class.php | 12 +++++++--- lib/purifier/purifier.class.php | 3 ++- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/lib/base/delegate/delegate.class.php b/lib/base/delegate/delegate.class.php index f4f0f3e5e1..74b4ff64e0 100644 --- a/lib/base/delegate/delegate.class.php +++ b/lib/base/delegate/delegate.class.php @@ -49,7 +49,8 @@ class baseDelegate public function __get($name) { // 如果有实例,尝试从实例中获取属性 - if (!is_null($this->instance) && property_exists($this->instance, $name)) { + if(!is_null($this->instance) && property_exists($this->instance, $name)) + { return $this->instance->$name; } @@ -70,7 +71,8 @@ class baseDelegate public function __set($name, $value) { // 如果有实例,尝试写入实例属性 - if (!is_null($this->instance) && property_exists($this->instance, $name)) { + if(!is_null($this->instance) && property_exists($this->instance, $name)) + { $this->instance->$name = $value; return; } @@ -91,11 +93,13 @@ class baseDelegate */ public function __call(string $name, array $arguments) { - if (is_null($this->instance)) { + if(is_null($this->instance)) + { throw new BadMethodCallException('The instance is not initialized.'); } - if (is_callable([$this->instance, $name])) { + if(is_callable([$this->instance, $name])) + { return call_user_func_array([$this->instance, $name], $arguments); } @@ -115,42 +119,50 @@ class baseDelegate public static function __callStatic(string $name, array $arguments) { $calledClass = get_called_class(); - if (!property_exists($calledClass, 'className')) { + if(!property_exists($calledClass, 'className')) + { throw new BadMethodCallException("The static property className does not exist in the class {$calledClass}."); } $className = $calledClass::$className; - if (empty($className)) { + if(empty($className)) + { throw new BadMethodCallException("The static property className is not set in the class {$calledClass}."); } - if (!class_exists($className)) { + if(!class_exists($className)) + { throw new BadMethodCallException("The class {$className} does not exist."); } - if (is_callable([$className, $name])) { + if(is_callable([$className, $name])) + { return call_user_func_array([$className, $name], $arguments); } - if (property_exists($className, $name) && count($arguments) === 1) { + if(property_exists($className, $name) && count($arguments) === 1) + { // 支持静态属性的直接赋值 $className::$$name = $arguments[0]; return; } - if (property_exists($className, $name) && count($arguments) === 0) { + if(property_exists($className, $name) && count($arguments) === 0) + { // 支持静态属性的直接读取 return $className::$$name; } - if (strpos($name, 'set') === 0 && property_exists($className, lcfirst(substr($name, 3))) && count($arguments) === 1) { + if(strpos($name, 'set') === 0 && property_exists($className, lcfirst(substr($name, 3))) && count($arguments) === 1) + { // 支持静态属性的 set 方法 $property = lcfirst(substr($name, 3)); $className::$$property = $arguments[0]; return; } - if (strpos($name, 'get') === 0 && property_exists($className, lcfirst(substr($name, 3))) && count($arguments) === 0) { + if(strpos($name, 'get') === 0 && property_exists($className, lcfirst(substr($name, 3))) && count($arguments) === 0) + { // 支持静态属性的 get 方法 $property = lcfirst(substr($name, 3)); return $className::$$property; diff --git a/lib/phpexcel/phpexcel.class.php b/lib/phpexcel/phpexcel.class.php index d07e35119b..bf11cb6c35 100644 --- a/lib/phpexcel/phpexcel.class.php +++ b/lib/phpexcel/phpexcel.class.php @@ -36,7 +36,9 @@ class phpExcel extends baseDelegate try { return IOFactory::createReader($type); - } catch (ReaderException $e) { + } + catch (ReaderException $e) + { throw $e; } } @@ -46,7 +48,9 @@ class phpExcel extends baseDelegate try { return IOFactory::createWriter($this->instance, ucfirst($type)); - } catch (WriterException $e) { + } + catch (WriterException $e) + { throw $e; } } @@ -58,7 +62,9 @@ class phpExcel extends baseDelegate $fileType = IOFactory::identify($file); $reader = IOFactory::createReader($fileType); return $fileType == 'Xls' || $fileType == 'Xlsx'; - } catch (ReaderException $e) { + } + catch (ReaderException $e) + { return false; } } diff --git a/lib/purifier/purifier.class.php b/lib/purifier/purifier.class.php index 26606fd346..779568f30c 100644 --- a/lib/purifier/purifier.class.php +++ b/lib/purifier/purifier.class.php @@ -23,7 +23,8 @@ class purifier extends baseDelegate { if(empty($config)) $config = $this->config; $purifierConfig = HTMLPurifier_Config::createDefault(); - foreach ($config as $key => $value) { + foreach($config as $key => $value) + { $purifierConfig->set($key, $value); } $this->instance = new static::$className($purifierConfig);