Get the device's fan states

@see $FAN_STATES

@param boolean $translate If true, return the string representation via self::$FAN_STATES
@return array The device's fan states
15266
public function fanStates( $translate = false )
    {
        $states = $this->getSNMP()->walk1d( self::OID_FAN_STATE );

        if( !$translate )
            return $states;

        return $this->getSNMP()->translate( $states, self::$FAN_STATES );
    }
419378
public static function getBooleanStrings(bool $state = null): array
    {
        $strings = [
            false => ['', '0', 'false', 'no', 'off'],
            true => ['1', 'true', 'yes', 'on']
        ];
        
        return isset($state) ? $strings[$state] : array_merge($strings[false], $strings[true]);
    }
1128226
public function physicalClass($translate = false) {
        $classes = $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_CLASS);

        if (!$translate) {
            return $classes;
        }

        return $this->getSNMP()->translate($classes, self::$ENTITY_PHSYICAL_CLASS);
    }
419881
static function fetchList( $localeList = array() )
    {
        $ini = eZINI::instance();

        $dir = $ini->variable( 'RegionalSettings', 'TranslationRepository' );

        $fileInfoList = array();
        $translationList = array();
        $locale = '';

        if ( count( $localeList ) == 0 )
        {
            $localeList = eZDir::findSubdirs( $dir );
        }

        foreach( $localeList as $locale )
        {
            if ( $locale != 'untranslated' )
            {
                $translationFiles = eZDir::findSubitems( $dir . '/' . $locale, 'f' );

                foreach( $translationFiles as $translationFile )
                {
                    if ( eZFile::suffix( $translationFile ) == 'ts' )
                    {
                        $translationList[] = new eZTSTranslator( $locale,  $translationFile );
                    }
                }
            }
        }

        return $translationList;
    }
1001451
public function getTranslatedList($user_id, $status = true)
    {
        $conditions = array(
            'status' => $status,
            'user_id' => $user_id
        );

        $addresses = array();
        foreach ((array) $this->getList($conditions) as $address_id => $address) {
            $addresses[$address_id] = $this->getTranslated($address, true);
        }

        return $addresses;
    }
72590
public function getKeys(
        array $domains = [],
        array $languages = []
    ) : array {
        return array_reduce(
            $this->getTranslations(
                $domains,
                $languages
            ),
            function (array $keys, Translation $translation) {
                $keys[] = $translation->getKey();

                return $keys;
            },
            []
        );
    }
141150
public function getTranslations(ExportCommand $exportCommand)
    {
        $locales = $this->determineLocalesToImport($exportCommand);
        $domains = $this->determineDomainsToImport($exportCommand);

        $translations = [];
        /** @var Translation $translation */
        foreach ($this->translationRepository->getTranslationsByLocalesAndDomains($locales, $domains) as $translation) {
            // Sort by translation key.
            $translations[$translation->getKeyword()][$translation->getLocale()] = $translation;
        }

        return $translations;
    }
490006
public function getHistory(Translation $translation)
    {
        $ordered = [];
        $histories = $this->getUnorderedHistory($translation);

        /** @var History $history */
        foreach ($histories as $history) {
            $ordered[$history->getLocale()][] = $history;
        }

        return $ordered;
    }
973841
private function _fans()
    {
        $sname = '';
        foreach ($this->_lines as $line) {
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
                $sname = trim($line);
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
                    $sname = ' ('.$snamebuf[1].')';
                } else {
                    $sname = '';
                }
            }
            $data = array();
            if (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)\)/", $line, $data)) {
                ;
            } elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)/", $line, $data)) {
                ;
            } elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM\)(.*)/", $line, $data)) {
                ;
            } elseif (preg_match("/^(.+):(.+) RPM\s*\(/", $line, $data)) {
                ;
            } else {
                preg_match("/^(.+):(.+) RPM$/", $line, $data);
            }
            if (count($data)>2) {
                 foreach ($data as $key=>$value) {
                    if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
                        $data[$key] = 0+trim($newvalue[1]);
                    } else {
                        $data[$key] = trim($value);
                    }
                }
                $dev = new SensorDevice();
                $dev->setName($data[1].$sname);
                $dev->setValue(trim($data[2]));
                if (isset($data[4])) {
                    $dev->setMin(trim($data[4]));
                }
                if (preg_match("/\sALARM\s*$/", $line)) {
                    $dev->setEvent("Alarm");
                }
                $this->mbinfo->setMbFan($dev);
            }
        }
    }
225239
public function getFrontendLocales($host = null)
    {
        $host = $this->getRealHost($host);

        if (isset($this->hosts[$host]['locales'])) {
            return array_keys($this->hosts[$host]['locales']);
        }

        return parent::getBackendLocales();
    }
978870
public function transform($translation)
    {
        $translation = $this->entityToArray(FileTranslation::class, $translation);
        return [
            'id'          => (int) $translation['id'],
            'langCode'    => $translation['lang_code'],
            'title'       => $translation['title'],
            'description' => $translation['description'],
            'createdAt'   => $translation['created_at'],
            'updatedAt'   => $translation['updated_at'],
        ];
    }
8404
public function getDeviceStates()
    {
        $uri = 'deviceStates';
        $response = $this->client->getEndpoint()->get($uri);

        $deviceStates = [];
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $deviceState) {
            $deviceStates[] = new DeviceState($this->client, $deviceState);
        }

        return $deviceStates;
    }
801187
public function ifLoopbackModeFlags( $translate = false )
    {
        $states = $this->getSNMP()->walk1d( self::OID_VLAN_IF_LOOPBACK_MODE_FLAG );

        if( !$translate )
            return $states;

        return $this->getSNMP()->translate( $states, self::$IF_VLAN_LOOPBACK_MODE_FLAGS );
    }
762262
public function systemPowerState( $translate = false )
    {
        $states = $this->getSNMP()->get( self::OID_SYSTEM_POWER_STATE );

        if( !$translate )
            return $states;

        return $this->getSNMP()->translate( $states, self::$POWER_STATES );
    }
792332
public static function translateKeys($records, $translations)
    {
        if (!self::iterable($records)) {
            return array();
        }
        
        $out = array();
        foreach ($records as $n => $record) {
            if (!self::iterable($record)) {
                $out[$n] = $record;
                continue;
            }
            $out[$n] = array();
            
            foreach ($record as $k => $v) {
                $new_k = (array_key_exists($k, $translations)) ? $translations[$k] : $k;
                $out[$n][$new_k] = $v;
            }
        }
        return $out;
    }
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
203062
public function getTranslations($reload = false)
    {
        if ($this->translations && ! $reload) {
            return $this->translations;
        }

        collect($this->disk->allFiles($this->languageFilesPath))
            ->filter(function ($file) {
                return $this->disk->extension($file) == 'json';
            })
            ->each(function ($file) {
                $this->translations[str_replace('.json', '', $file->getFilename())]
                    = json_decode($file->getContents());
            });

        return $this->translations;
    }