mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10631] Remove code duplication
PHPBB3-10631
This commit is contained in:
parent
8bbab088dd
commit
4314284de1
1 changed files with 21 additions and 14 deletions
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue