mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/10631] Remove code duplication
PHPBB3-10631
This commit is contained in:
committed by
Unknown Bliss
parent
8bbab088dd
commit
4314284de1
@@ -232,22 +232,29 @@ class phpbb_extension_metadata_manager
|
|||||||
*/
|
*/
|
||||||
public function validate_metadata_array()
|
public function validate_metadata_array()
|
||||||
{
|
{
|
||||||
$validate = array(
|
foreach ($this->validation as $name => $regex)
|
||||||
'name',
|
|
||||||
'type',
|
|
||||||
'licence',
|
|
||||||
'description',
|
|
||||||
'version',
|
|
||||||
'extra_display-name',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($validate as $type)
|
|
||||||
{
|
{
|
||||||
$type = 'validate_' . $type;
|
if (is_array($regex))
|
||||||
|
|
||||||
if (!$this->$type())
|
|
||||||
{
|
{
|
||||||
return false;
|
foreach ($regex as $extra_name => $extra_regex)
|
||||||
|
{
|
||||||
|
$type = 'validate_' . $name . '_' . $extra_name;
|
||||||
|
|
||||||
|
if (!$this->$type())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$type = 'validate_' . $name;
|
||||||
|
|
||||||
|
if (!$this->$type())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user