[icinga-checkins] icinga.org: icingaweb2-module-director/master: Import: fix some type hints and comments

git at icinga.org git at icinga.org
Fri Dec 30 10:20:34 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: fae2a57ed52ada23f9786ba61e91b685900a7935
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=fae2a57ed52ada23f9786ba61e91b685900a7935

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Dec 30 10:20:24 2016 +0100

Import: fix some type hints and comments

---

 library/Director/Import/Import.php |   30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/library/Director/Import/Import.php b/library/Director/Import/Import.php
index ddef225..05847a4 100644
--- a/library/Director/Import/Import.php
+++ b/library/Director/Import/Import.php
@@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Import;
 
 use Exception;
 use Icinga\Exception\IcingaException;
+use Icinga\Module\Director\Db;
 use Icinga\Module\Director\Hook\ImportSourceHook;
 use Icinga\Module\Director\Objects\ImportSource;
 use Icinga\Module\Director\Util;
@@ -17,12 +18,12 @@ class Import
     protected $source;
 
     /**
-     * @var Icinga\Data\Db\DbConnection
+     * @var Db
      */
     protected $connection;
 
     /**
-     * @var Zend_Db_Adapter_Abstract
+     * @var \Zend_Db_Adapter_Abstract
      */
     protected $db;
 
@@ -100,7 +101,7 @@ class Import
         $this->db->insert(
             'import_run',
             array(
-                'source_id'       => $this->source->id,
+                'source_id'       => $this->source->get('id'),
                 'rowset_checksum' => $this->quoteBinary($this->rowsetChecksum()),
                 'start_time'      => date('Y-m-d H:i:s'),
                 'succeeded'       => 'y'
@@ -155,13 +156,13 @@ class Import
     /**
      * Checksum of all available rows
      *
-     * @return string
+     * @return array
      */
     protected function & rawData()
     {
         if ($this->data === null) {
             $this->data = ImportSourceHook::loadByName(
-                $this->source->source_name,
+                $this->source->get('source_name'),
                 $this->connection
             )->fetchData();
         }
@@ -173,6 +174,9 @@ class Import
     /**
      * Prepare and remember an ImportedProperty
      *
+     * @param string $key
+     * @param mixed  $rawValue
+     *
      * @return array
      */
     protected function prepareImportedProperty($key, $rawValue)
@@ -207,7 +211,7 @@ class Import
      */
     protected function prepareChecksummedRows()
     {
-        $keyColumn = $this->source->key_column;
+        $keyColumn = $this->source->get('key_column');
         $this->rows = array();
         $this->rowProperties = array();
         $objects = array();
@@ -329,10 +333,14 @@ class Import
 
     /**
      * Whether the last run of this import matches the given checksum
+     *
+     * @param  string $checksum Binary checksum
+     *
+     * @return bool
      */
     protected function lastRowsetIs($checksum)
     {
-        return $this->connection->getLatestImportedChecksum($this->source->id)
+        return $this->connection->getLatestImportedChecksum($this->source->get('id'))
             === Util::binary2hex($checksum);
     }
 
@@ -406,6 +414,10 @@ class Import
 
     /**
      * Sort a given stdClass object by property name
+     *
+     * @param  stdClass $object
+     *
+     * @return object
      */
     protected function sortObject($object)
     {
@@ -422,6 +434,8 @@ class Import
      *
      * Please note that the array itself will NOT be sorted, as arrays must
      * keep their ordering
+     *
+     * @param array $array
      */
     protected function sortArrayObject(& $array)
     {
@@ -432,6 +446,8 @@ class Import
 
     /**
      * Recursively sort a given property
+     *
+     * @param mixed $el
      */
     protected function sortElement(& $el)
     {



More information about the icinga-checkins mailing list