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

@@ -53,12 +53,12 @@ class API_OAuth2_Form_DevAppDesktop
/**
*
* @var string
* @var string
*/
public $type;
public $scheme_website;
public $urlwebsite;
/**
*
* @param Request $request
@@ -116,7 +116,7 @@ class API_OAuth2_Form_DevAppDesktop
/**
*
* @return string
* @return string
*/
public function getType()
{
@@ -132,7 +132,7 @@ class API_OAuth2_Form_DevAppDesktop
{
return $this->urlwebsite;
}
public function getSchemeCallback()
{
return '';
@@ -152,7 +152,8 @@ 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

@@ -50,10 +50,10 @@ class API_OAuth2_Form_DevAppInternet
* @var string
*/
public $callback;
public $scheme_website;
public $scheme_callback;
public $urlwebsite;
public $urlcallback;
@@ -71,10 +71,10 @@ class API_OAuth2_Form_DevAppInternet
$this->scheme_website = $request->get('scheme-website', 'http://');
$this->scheme_callback = $request->get('scheme-callback', 'http://');
$this->type = API_OAuth2_Application::WEB_TYPE;
$this->urlwebsite = $this->scheme_website.$this->website;
$this->urlcallback = $this->scheme_callback.$this->callback;
return $this;
}
@@ -116,7 +116,7 @@ class API_OAuth2_Form_DevAppInternet
/**
*
* @return string
* @return string
*/
public function getType()
{
@@ -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

@@ -207,7 +207,7 @@ class API_V1_adapter extends API_V1_Abstract
public function caption_records(Request $request, $databox_id, $record_id)
{
$result = new API_V1_result($request, $this);
$record = $this->appbox->get_databox($databox_id)->get_record($record_id);
$fields = $record->get_caption()->get_fields();
$ret = array();
@@ -220,9 +220,10 @@ class API_V1_adapter extends API_V1_Abstract
);
}
$result->set_datas($ret);
return $result;
}
/**
* Get an API_V1_result containing the results of a records search
*

View File

@@ -130,17 +130,17 @@ class Bridge_Api_Dailymotion_Container implements Bridge_Api_ContainerInterface
{
return $this->url;
}
public function get_duration()
{
return '';
}
public function get_category()
{
return '';
}
public function is_private()
{
return null;

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

@@ -138,17 +138,17 @@ class Bridge_Api_Flickr_Container implements Bridge_Api_ContainerInterface
return $this->type;
}
public function get_duration()
{
return '';
}
public function get_category()
{
return '';
}
public function is_private()
{
return null;

View File

@@ -121,14 +121,14 @@ class Bridge_Api_Youtube_Container implements Bridge_Api_ContainerInterface
{
return '';
}
public function get_category()
{
return '';
}
public function is_private()
{
return null;

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

@@ -645,7 +645,7 @@ class module_report_activity extends module_report
{
unset($this->result[$i]);
}
if (isset($this->result[$i]['poiddoc']) && isset($this->result[$i]['poidprev']))
{
$this->result[$i]['poiddoc'] = p4string::format_octets($this->result[$i]['poiddoc']);
@@ -653,7 +653,7 @@ class module_report_activity extends module_report
}
}
$i++;
$this->result[$i]['nbprev'] = 0;
@@ -692,7 +692,7 @@ class module_report_activity extends module_report
$save_user = $user;
}
unset($this->result[$i]);
$nb_row = $i + 1;
$this->total = $nb_row;
@@ -772,7 +772,7 @@ class module_report_activity extends module_report
}
catch (Exception $e)
{
}
}
elseif ($value == "size")

View File

@@ -64,9 +64,9 @@ class patch_3602 implements patchInterface
}
catch(\PDOException $e)
{
}
return true;
}

View File

@@ -222,13 +222,13 @@ class set_order extends set_abstract
$core = \bootstrap::getCore();
$em = $core->getEntityManager();
$Basket = null;
/* @var $repository \Repositories\BasketRepository */
if($this->ssel_id)
{
$repository = $em->getRepository('\Entities\Basket');
try
{
$Basket = $repository->findUserBasket($this->ssel_id, $core->getAuthenticatedUser(), false);
@@ -284,8 +284,8 @@ class set_order extends set_abstract
$Basket->addBasketElement($BasketElement);
$em->persist($BasketElement);
$params = array(
':usr_id' => $session->get_usr_id()
, ':order_id' => $this->id

View File

@@ -607,15 +607,15 @@ class setup
if ($Core->getCache()->isServer())
{
$stats = $Core->getCache()->getStats();
echo '<li>' . sprintf(_('setup::Serveur actif sur %s'), $registry->get('GV_cache_server_host') . ':' . $registry->get('GV_cache_server_port')) . '</li>';
echo "<table>";
foreach ($stats as $name => $stat)
{
echo "<tr class='even'><td>" . $name . "</td><td> " . $stat . "</td></tr>";
}
echo "</table>";
}
else
@@ -806,7 +806,7 @@ class setup
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
$appConf->delete();
return;
}

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'));