cleanup fixes
[civicrm-core.git] / bin / cli.class.php
index 9b8823472f886cfc1ee53ea7e76ab728e62d28f3..d1db53c541d28b48bddc9c2690c3de4ba558a623 100644 (file)
  * In addition, there are several additional classes that inherit
  * civicrm_cli to do more precise functions.
  *
- **/
+ */
 
 /**
  * base class for doing all command line operations via civicrm
  * used by cli.php
- **/
-
+ */
 class civicrm_cli {
   // required values that must be passed
   // via the command line
@@ -138,7 +137,7 @@ class civicrm_cli {
       // find the value of this arg
       if (preg_match('/=/', $arg)) {
         $parts = explode('=', $arg);
-        $arg   = $parts[0];
+        $arg = $parts[0];
         $value = $parts[1];
       }
       else {
@@ -199,7 +198,7 @@ class civicrm_cli {
     $_SERVER['HTTP_HOST'] = $this->_site;
     $_SERVER['REMOTE_ADDR'] = "127.0.0.1";
     $_SERVER['SERVER_SOFTWARE'] = NULL;
-    $_SERVER['REQUEST_METHOD']  = 'GET';
+    $_SERVER['REQUEST_METHOD'] = 'GET';
 
     // SCRIPT_FILENAME needed by CRM_Utils_System::cmsRootPath
     $_SERVER['SCRIPT_FILENAME'] = __FILE__;
@@ -224,9 +223,9 @@ class civicrm_cli {
     // Now we have a Config object, we can set it from the Base URL.
     if ($_SERVER['HTTP_HOST'] == 'localhost') {
       $_SERVER['HTTP_HOST'] = preg_replace(
-                '!^https?://([^/]+)/$!i',
-                '$1',
-                $this->_config->userFrameworkBaseURL);
+        '!^https?://([^/]+)/$!i',
+        '$1',
+        $this->_config->userFrameworkBaseURL);
     }
 
     $class = 'CRM_Utils_System_' . $this->_config->userFramework;
@@ -313,20 +312,18 @@ class civicrm_cli {
 /**
  * class used by csv/export.php to export records from
  * the database in a csv file format.
- **/
-
+ */
 class civicrm_cli_csv_exporter extends civicrm_cli {
   var $separator = ',';
 
   /**
-   *
    */
-  function __construct() {
+  public function __construct() {
     $this->_required_arguments = array('entity');
     parent::initialize();
   }
 
-  function run() {
+  public function run() {
     $out = fopen("php://output", 'w');
     fputcsv($out, $this->columns, $this->separator, '"');
 
@@ -358,22 +355,20 @@ class civicrm_cli_csv_exporter extends civicrm_cli {
  * and civicrm_cli_csv_deleter to add or delete
  * records based on those found in a csv file
  * passed to the script.
- **/
-
+ */
 class civicrm_cli_csv_file extends civicrm_cli {
   var $header;
   var $separator = ',';
 
   /**
-   *
    */
-  function __construct() {
+  public function __construct() {
     $this->_required_arguments = array('entity', 'file');
     $this->_additional_arguments = array('f' => 'file');
     parent::initialize();
   }
 
-  function run() {
+  public function run() {
     $this->row = 1;
     $handle = fopen($this->_file, "r");
 
@@ -405,7 +400,7 @@ class civicrm_cli_csv_file extends civicrm_cli {
       $this->processLine($params);
     }
     fclose($handle);
-    return;
+    return NULL;
   }
 
   /* return a params as expected */
@@ -414,7 +409,7 @@ class civicrm_cli_csv_file extends civicrm_cli {
    *
    * @return array
    */
-  function convertLine($data) {
+  public function convertLine($data) {
     $params = array();
     foreach ($this->header as $i => $field) {
       //split any multiselect data, denoted with CRM_Core_DAO::VALUE_SEPARATOR
@@ -433,13 +428,12 @@ class civicrm_cli_csv_file extends civicrm_cli {
  * class for processing records to add
  * used by csv/import.php
  *
- **/
-
+ */
 class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
   /**
    * @param array $params
    */
-  function processline($params) {
+  public function processline($params) {
     $result = civicrm_api($this->_entity, 'Create', $params);
     if ($result['is_error']) {
       echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
@@ -454,13 +448,12 @@ class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
  * class for processing records to delete
  * used by csv/delete.php
  *
- **/
-
+ */
 class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
   /**
    * @param array $params
    */
-  function processline($params) {
+  public function processline($params) {
     $result = civicrm_api($this->_entity, 'Delete', $params);
     if ($result['is_error']) {
       echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";