Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 112fb49

Browse files
committed
STYLE: refs #257. Adding a style test and fixing the results.
1 parent e0d99c3 commit 112fb49

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

modules/api/library/APIEnabledNotification.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ApiEnabled_Notification extends MIDAS_Notification
2121
* This function is for getting the webapi methods defined in the API
2222
* component of the implementing class. To enable this add the following
2323
* line to your init function.
24-
*
24+
*
2525
* $this->enableWebAPI();
2626
*
2727
*/
@@ -30,34 +30,34 @@ public function getWebApiMethods()
3030
$methods = array();
3131
$r = new ReflectionClass($this->ModuleComponent->Api);
3232
$meths = $r->getMethods(ReflectionMethod::IS_PUBLIC);
33-
foreach( $meths as $m )
33+
foreach($meths as $m)
3434
{
35-
if(strpos($m->getDeclaringClass()->getName(),'ApiComponent'))
35+
if(strpos($m->getDeclaringClass()->getName(), 'ApiComponent'))
3636
{
3737
$realName = $m->getName();
3838
$docString = $m->getDocComment();
39-
$docString = trim($docString,'/');
40-
$docAttributes = explode('@',$docString);
39+
$docString = trim($docString, '/');
40+
$docAttributes = explode('@', $docString);
4141
$return = '';
4242
$description = '';
4343
$params = array();
4444
$example = array();
45-
foreach( $docAttributes as $docEntry )
45+
foreach($docAttributes as $docEntry)
4646
{
47-
$explodedDoc = explode('*',$docEntry);
47+
$explodedDoc = explode('*', $docEntry);
4848
array_walk($explodedDoc,
4949
create_function('&$val', '$val = trim($val);'));
50-
$doc = implode('',$explodedDoc);
51-
if(strpos($doc,'param') === 0)
50+
$doc = implode('', $explodedDoc);
51+
if(strpos($doc, 'param') === 0)
5252
{
53-
$splitParam = explode(' ',$doc);
53+
$splitParam = explode(' ', $doc);
5454
$paramName = trim($splitParam[1]);
55-
$paramValue = trim(implode(' ',array_slice($splitParam,2)));
55+
$paramValue = trim(implode(' ', array_slice($splitParam, 2)));
5656
$params[$paramName] = $paramValue;
5757
}
58-
elseif(strpos($doc,'return') === 0)
58+
elseif(strpos($doc, 'return') === 0)
5959
{
60-
$return = trim(substr($doc,6));
60+
$return = trim(substr($doc, 6));
6161
}
6262
else
6363
{
@@ -70,7 +70,7 @@ public function getWebApiMethods()
7070
$help['example'] = $example;
7171
$help['return'] = $return;
7272
$help['description'] = $description;
73-
$methods[] = array('name'=> $name,
73+
$methods[] = array('name' => $name,
7474
'help' => $help,
7575
'callbackObject' => &$this->ModuleComponent->Api,
7676
'callbackFunction' => $realName);

modules/api/tests/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ add_subdirectory( models )
55
add_midas_style_test( StyleApiControllers ${CMAKE_SOURCE_DIR}/modules/api/controllers )
66
add_midas_style_test( StyleApiModels ${CMAKE_SOURCE_DIR}/modules/api/models )
77
add_midas_style_test( StyleTestsApiControllers ${CMAKE_SOURCE_DIR}/modules/api/tests/controllers )
8-
add_midas_style_test( StyleTestsApiModels ${CMAKE_SOURCE_DIR}/modules/api/tests/models )
8+
add_midas_style_test( StyleTestsApiModels ${CMAKE_SOURCE_DIR}/modules/api/tests/models )
9+
add_midas_style_test(StyleApiEnabledNotification
10+
${CMAKE_SOURCE_DIR}/modules/api/library/APIEnabledNotification.php)

0 commit comments

Comments
 (0)