Проверка наличия модели в данном модуле (приложении)
@param $shortName
@return bool
497714
public static function hasModel($shortName, $instaitiateOnTrue = false)
    {
        $models = static::models();
        if (isset($models[$shortName])) {
            if ($instaitiateOnTrue) {
                $className = $models[$shortName];
                return $className::model();
            } else {
                return true;
            }
        }
        return false;
    }
1211952
public function checkForUpdates($quick = false)
    {

        if (!$this->subModuleUpdater) {
            $this->site->getVariables()->setValue("last_checked", time());
        }
        if ($this->canBeUpdated === null) {
            $this->canBeUpdated = $this->site->getVariables()->getValue("can_be_updated") == 1;
        }
        if ($this->canBeUpdated) {
            return true;
        }

        if($quick){
            return false;
        }

        $this->exec("git fetch");

        $updateAvailable = ($this->getRevision('HEAD') != $this->getRevision("origin/" . $this->currentBranch()) || array_reduce($this->subUpdaters, function ($result, Updater $input) {
                return $result || $input->checkForUpdates();
            }, false));
        if ($this->canBeUpdated != $updateAvailable) {
            $this->site->getVariables()->setValue("can_be_updated", $updateAvailable ? 1 : 0);
        }

        return $this->canBeUpdated = $updateAvailable;
    }
1060554
public function checkFolderIsEmptyOrNot(string $folderName):bool
    {
        $files = array ();
        if ($handle = opendir($folderName)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    $files [] = $file;
                }
            }
            closedir($handle);
        }
        return ((count($files) === 0) ?  true : false);
    }
1012707
protected function getDescription($shortName)
    {
        return sprintf(
            '%s has been %s with %s = "%s"',
            $shortName,
            $this->getEventShortName(),
            $this->getIdField(),
            $this->getIdValue()
        );
    }
99120
public static function generate_shortname($data, $templateshortname) {
        if (empty($templateshortname) && !is_numeric($templateshortname)) {
            return null;
        }
        if (strpos($templateshortname, '%') === false) {
            return $templateshortname;
        }

        $course = (object) $data;
        $fullname   = isset($course->fullname) ? $course->fullname : '';
        $idnumber   = isset($course->idnumber) ? $course->idnumber  : '';

        $callback = partial(array('tool_uploadcourse_helper', 'generate_shortname_callback'), $fullname, $idnumber);
        $result = preg_replace_callback('/(?<!%)%([+~-])?(\d)*([fi])/', $callback, $templateshortname);

        if (!is_null($result)) {
            $result = clean_param($result, PARAM_TEXT);
        }

        if (empty($result) && !is_numeric($result)) {
            $result = null;
        }

        return $result;
    }
505603
private function getShortPath($filename)
    {
        if (getcwd() === dirname($filename)) {
            return basename($filename);
        }
        $homeDir = Filesystem::getHomeDirectory();
        if (strpos($filename, $homeDir) === 0) {
            return str_replace($homeDir, '~', $filename);
        }

        return $filename;
    }
68498
public function withShortName(string $shortName): self
    {
        $metadata = clone $this;
        $metadata->shortName = $shortName;

        return $metadata;
    }
898466
public function getShortNames()
    {
        $names = [];

        $used = [];
        foreach (static::SHORT_NAME as $name => $value) {
            if ($this->has($value) && !in_array($value, $used)) {
                $names[] = $name;
                $used[] = $value;
            }
        }

        return $names;
    }
1201499
public function clearCacheByName($short_name)
    {
        $cid = $this->getCid($short_name);
        unset($this->schemaFiles[$short_name]);
        $this->clearCache($cid);
    }
365353
public function getShortName()
    {
        $value = $this->getValue();
        if (empty($value) || !ClassInfo::exists($value)) {
            return null;
        }
        return ClassInfo::shortName($value);
    }
787457
protected function shortName($name)
    {
        $name = str_replace('_', ' ', $name);
        $name = ucwords($name);

        return str_replace(' ', '', $name);
    }
21855
public function setShort($short)
    {
        if (!(is_null($short) || preg_match("/^[a-zA-Z0-9?!§$%#]$/", $short))) {
            throw new \InvalidArgumentException(sprintf(
                'Short option must be null or one of [a-zA-Z0-9?!§$%%#], found \'%s\'',
                $short
            ));
        }
        $this->short = $short;
        return $this;
    }
888689
public function getLanguageByShortCode($shortCode)
    {
        return isset($this->getLanguages()[$shortCode]) ? $this->getLanguages()[$shortCode] : false;
    }
944847
public final function formatNamedDate( bool $short = false )
      : string
   {

      if ( $short )
      {
         return \sprintf(
            '%s., %s. %s %d',
            $this->getShortWeekDayName(),
            $this->getDay(),
            $this->getShortMonthName(),
            $this->getYear()
         );
      }

      return \sprintf(
         '%s, %s. %s %d',
         $this->getWeekDayName(),
         $this->getDay(),
         $this->getMonthName(),
         $this->getYear()
      );

   }
948960
public static function deleteThumbnail($filename) {
        $pos = strrpos($filename, '.');
        if ($pos === false) {
            return false;
        }
        $shortname = substr($filename, 0, $pos);
        $ext       = substr($filename, $pos);
        $filep     = $shortname . '-*' . $ext;
        $files     = glob($filep);
        if ($files) {
            foreach ($files as $f) {
                @unlink($f);
            }
        }

        return true;
    }
521150
protected function _createShell($className, $shortName)
    {
        $instance = parent::_createShell($className, $shortName);
        $webIo = new ConsoleIo(
            new WebConsoleOutput(),
            new WebConsoleOutput(),
            new WebConsoleInput()
        );
        $instance->io($webIo);

        return $instance;
    }
211820
public function rename($short_name)
    {
        unset($this->owner->elements[$this->short_name]);
        $this->name = $this->name.'_'.$short_name;
        $this->short_name = $short_name;

        if (!$this->auto_track_element) {
            $this->owner->elements[$short_name] = true;
        } else {
            $this->owner->elements[$short_name] = $this;
        }

        return $this;
    }