Coding Standards

This commit is contained in:
Romain Neutron
2012-02-13 18:23:06 +01:00
parent bc9470290b
commit 8a154e21c1
40 changed files with 99 additions and 63 deletions

View File

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

View File

@@ -1112,6 +1112,7 @@ class API_V1_adapter extends API_V1_Abstract
* @todo ajouter une option pour avoir les values serialisées
* dans un cas multi
*/
return array(
'meta_id' => $value->getId()
, 'meta_structure_id' => $field->get_meta_struct_id()

View File

@@ -137,6 +137,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
foreach ($this->retrieve_fields() as $meta_struct_id => $field)
{
if ($field->get_name() == $fieldname)
return $field;
}

View File

@@ -100,6 +100,7 @@ class geonames
$cityName = self::clean_input($cityName);
if (strlen($cityName) === 0)
return $output;
$registry = registry::get_instance();
@@ -140,6 +141,7 @@ class geonames
public function find_geoname_from_ip($ip)
{
if (array_key_exists($ip, $this->cache_ips))
return $this->cache_ips[$ip];
$output = array(

View File

@@ -87,6 +87,7 @@ class module_console_fileConfigCheck extends Command
if (!$this->configuration->isInstalled())
{
$output->writeln(sprintf("\nPhraseanet is not installed\n"));
return 1;
}
}
@@ -111,6 +112,7 @@ class module_console_fileConfigCheck extends Command
)
);
$output->writeln(sprintf("\nConfig check test suite can not continue please correct FATAL error and relaunch.\n"));
return 1;
}
}
@@ -138,6 +140,7 @@ class module_console_fileConfigCheck extends Command
);
}
}
return (int) ($nbErrors > 0);
}

View File

@@ -80,6 +80,7 @@ class module_console_fileEnsureProductionSetting extends Command
if (!$this->configuration->isInstalled())
{
$output->writeln(sprintf("\nPhraseanet is not installed\n"));
return 1;
}
}
@@ -104,6 +105,7 @@ class module_console_fileEnsureProductionSetting extends Command
)
);
$output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n"));
return 1;
}
}

View File

@@ -44,6 +44,7 @@ class module_console_schedulerStart extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}

View File

@@ -39,6 +39,7 @@ class module_console_schedulerState extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -61,6 +62,7 @@ class module_console_schedulerState extends Command
{
$output->writeln(sprintf('Scheduler is %s', $state['schedstatus']));
}
return 0;
}
catch(\Exception $e)

View File

@@ -39,6 +39,7 @@ class module_console_schedulerStop extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -49,6 +50,7 @@ class module_console_schedulerStop extends Command
$appbox = appbox::get_instance();
$task_manager = new task_manager($appbox);
$task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP);
return 0;
}
catch (\Exception $e)

View File

@@ -46,6 +46,7 @@ class module_console_systemBackupDB extends Command
if (!setup::is_installed())
{
$output->writeln('Argument must be an Id.');
return 1;
}
@@ -96,11 +97,13 @@ class module_console_systemBackupDB extends Command
if (file_exists($filename) && filesize($filename) > 0)
{
$output->writeln('OK');
return true;
}
else
{
$output->writeln('<error>Failed</error>');
return false;
}

View File

@@ -99,6 +99,7 @@ class module_console_systemConfigCheck extends Command
$hasError = true;
}
}
return !$hasError;
}
@@ -118,6 +119,7 @@ class module_console_systemConfigCheck extends Command
{
$output->writeln("\t/!\\\t<comment>" . $constraint->get_message() . '</comment>');
}
return $ok;
}

View File

@@ -40,6 +40,7 @@ class module_console_tasklist extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -60,6 +61,7 @@ class module_console_tasklist extends Command
{
$this->print_task($task, $output);
}
return 0;
}
catch (\Exception $e)

View File

@@ -48,6 +48,7 @@ class module_console_taskrun extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -58,6 +59,7 @@ class module_console_taskrun extends Command
if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id')))
{
$output->writeln('Argument must be an Id.');
return 1;
}

View File

@@ -1736,6 +1736,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
{
$hd = $this->get_subdef('document');
if ($hd->is_physically_present())
return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file());
return null;
}

View File

@@ -211,6 +211,7 @@ class record_preview extends record_adapter
public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null)
{
if ($this->train)
return $this->train;
switch ($this->env)
@@ -273,6 +274,7 @@ class record_preview extends record_adapter
public function get_title($highlight = '', searchEngine_adapter $search_engine = null)
{
if ($this->title)
return $this->title;
$this->title = collection::getLogo($this->get_base_id()) . ' ';
@@ -329,6 +331,7 @@ class record_preview extends record_adapter
public function get_short_history()
{
if (!is_null($this->short_history))
return $this->short_history;
$tab = array();
@@ -421,6 +424,7 @@ class record_preview extends record_adapter
public function get_view_popularity()
{
if (!is_null($this->view_popularity))
return $this->view_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();
@@ -518,6 +522,7 @@ class record_preview extends record_adapter
public function get_refferer_popularity()
{
if (!is_null($this->refferer_popularity))
return $this->refferer_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();
@@ -604,6 +609,7 @@ class record_preview extends record_adapter
{
if (!is_null($this->download_popularity))
return $this->download_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();

View File

@@ -762,6 +762,7 @@ class set_export extends set_abstract
return false;
}
if (isset($list['complete']) && $list['complete'] === true)
return;

View File

@@ -87,6 +87,7 @@
o.addClass( "ui-state-error" );
updateTips( "Special characters (except minus) or espaces are not authorized" );
}
return ok;
}

View File

@@ -82,6 +82,7 @@
role = $(this).val();
shareWith(usr_id, role);
return false;
});
@@ -107,6 +108,7 @@
humane.error(data.message);
}
$dialog.refresh();
return;
},
error: function(){
@@ -137,6 +139,7 @@
{
shareWith(ui.item.usr_id);
}
return false;
}
})