Coding standards

This commit is contained in:
Romain Neutron
2012-03-09 12:49:13 +01:00
parent 20a771ae37
commit 82d9eeef7b
64 changed files with 217 additions and 175 deletions

View File

@@ -67,8 +67,10 @@ return call_user_func(function()
$app->get('/', function() use ($app)
{
if ($app['install'] === true)
return $app->redirect('/setup/installer/');
if ($app['upgrade'] === true)
return $app->redirect('/setup/upgrader/');
});

View File

@@ -40,6 +40,7 @@ class ArrayCache extends DoctrineArray implements Cache
{
throw new Exception(sprintf('Unable to find key %s', $id));
}
return $this->fetch($id);
}

View File

@@ -49,6 +49,7 @@ class Configuration
{
$specifications = new Configuration\ApplicationSpecification();
}
return new self($specifications, $environment);
}

View File

@@ -134,12 +134,14 @@ class ApplicationSpecification implements Specification
$this->getConfigurationsFile();
$this->getConnexionsFile();
$this->getServicesFile();
return true;
}
catch (\Exception $e)
{
}
return false;
}

View File

@@ -56,6 +56,7 @@ class StoryWZRepository extends EntityRepository
{
return 0;
}
return ($a < $b) ? -1 : 1;
});

View File

@@ -152,6 +152,7 @@ class API_OAuth2_Form_DevAppDesktop
$metadata->addPropertyConstraint('description', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('urlwebsite', new Constraints\Url($url));
return;
}

View File

@@ -159,6 +159,7 @@ class API_OAuth2_Form_DevAppInternet
$metadata->addPropertyConstraint('urlwebsite', new Constraints\Url($url));
$metadata->addPropertyConstraint('urlcallback', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('urlcallback', new Constraints\Url($url));
return;
}

View File

@@ -220,6 +220,7 @@ class API_V1_adapter extends API_V1_Abstract
);
}
$result->set_datas($ret);
return $result;
}

View File

@@ -377,6 +377,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
if (!$response->isOk())
{
if ($response->err_code === 3) //Already exists in photoset
return;
throw new Bridge_Exception_ApiConnectorRequestFailed();
}
@@ -663,12 +664,15 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
{
if (!$this->registry->get('GV_flickr_api'))
return false;
if (trim($this->registry->get('GV_flickr_client_id')) === '')
return false;
if (trim($this->registry->get('GV_flickr_client_secret')) === '')
return false;
return true;

View File

@@ -136,10 +136,12 @@ class appbox extends base
$custom_path.= $collection->get_base_id();
if (is_null($pathfile))
return $this;
$datas = file_get_contents($pathfile->getPathname());
if (is_null($datas))
return $this;
file_put_contents($file, $datas);
@@ -191,10 +193,12 @@ class appbox extends base
$custom_path.= $pic_type . '_' . $databox->get_sbas_id();
if (is_null($pathfile))
return $this;
$datas = file_get_contents($pathfile->getPathname());
if (is_null($datas))
return $this;
file_put_contents($file, $datas);
@@ -540,6 +544,7 @@ class appbox extends base
public function get_databoxes()
{
if ($this->databoxes)
return $this->databoxes;
$ret = array();

View File

@@ -79,6 +79,7 @@ abstract class base implements cache_cacheableInterface
public function get_schema()
{
if ($this->schema)
return $this->schema;
$this->load_schema();
@@ -167,6 +168,7 @@ abstract class base implements cache_cacheableInterface
{
$this->cache = $this->Core->getCache();
}
return $this->cache;
}
@@ -232,6 +234,7 @@ abstract class base implements cache_cacheableInterface
{
if ($this->version)
return $this->version;
$version = '0.0.0';
@@ -260,8 +263,10 @@ abstract class base implements cache_cacheableInterface
public function upgradeavailable()
{
if ($this->get_version())
return version_compare(\Alchemy\Phrasea\Core\Version::getNumber(), $this->get_version(), '>');
else
return true;
}
@@ -399,6 +404,7 @@ abstract class base implements cache_cacheableInterface
protected function load_schema()
{
if ($this->schema)
return $this;
$structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml");

View File

@@ -59,6 +59,7 @@ class cache_databox
if ($date <= $last_update)
{
self::$refreshing = false;
return;
}

View File

@@ -79,6 +79,7 @@ class gatekeeper
$session = $appbox->get_session();
if (http_request::is_command_line())
return;
if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF']))
@@ -131,6 +132,7 @@ class gatekeeper
if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php')
return;
phrasea::redirect('/login/?redirect=/thesaurus2');
break;
@@ -139,6 +141,7 @@ class gatekeeper
break;
case 'admin':
if ($this->_script_name === 'runscheduler.php')
return;
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
break;
@@ -158,6 +161,7 @@ class gatekeeper
return;
case 'setup':
if ($appbox->upgradeavailable())
return;
else
phrasea::redirect('/login/');
@@ -274,6 +278,7 @@ class gatekeeper
$parm = $request->get_parms('LOG');
if (is_null($parm["LOG"]))
return $this;
try

View File

@@ -306,6 +306,7 @@ class module_console_fileEnsureDevSetting extends Command
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
$this->errors++;
}
return;
}
@@ -447,6 +448,7 @@ class module_console_fileEnsureDevSetting extends Command
{
$config = new \Doctrine\DBAL\Configuration();
$conn = \Doctrine\DBAL\DriverManager::getConnection($connexion->all(), $config);
return true;
}
catch (\Exception $e)

View File

@@ -300,6 +300,7 @@ class module_console_fileEnsureProductionSetting extends Command
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
$this->errors++;
}
return;
}
@@ -441,6 +442,7 @@ class module_console_fileEnsureProductionSetting extends Command
{
$config = new \Doctrine\DBAL\Configuration();
$conn = \Doctrine\DBAL\DriverManager::getConnection($connexion->all(), $config);
return true;
}
catch (\Exception $e)
@@ -896,6 +898,7 @@ class module_console_fileEnsureProductionSetting extends Command
{
return false;
}
return $server === $Service->getDriver()->isServer();
}

View File

@@ -99,6 +99,7 @@ class sphinxrt
$cl = new SphinxClient();
if ($cl->Status() === false)
return $this;
$cl->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port'));

View File

@@ -35,6 +35,7 @@ $extractDateFields = function(\Alchemy\Phrasea\Core $Core) {
$date_sort_fields[$date['fieldname']] = $date['fieldname'];
}
}
return $date_sort_fields;
};

View File

@@ -53,6 +53,7 @@
{
var val = $.trim($('#auto_order').val());
if(val == '')
return;
var sorter = {};

View File

@@ -53,6 +53,7 @@
{
var val = $.trim($('#auto_order').val());
if(val == '')
return;
var sorter = {};

View File

@@ -155,6 +155,7 @@
humane.error(data.message);
}
$dialog.refresh();
return;
},
error: function(){

View File

@@ -292,6 +292,7 @@ phrasea::headers();
},
success: function(data){
alert(data.message);
return;
}
});