application/Espo/Core/Utils/File/Unifier.php
public function unify($name, $paths, $recursively = false)
    {
        $content = $this->unifySingle($paths['corePath'], $name, $recursively);

        if (!empty($paths['modulePath'])) {
            $customDir = strstr($paths['modulePath'], '{*}', true);

            $moduleList = isset($this->metadata) ? $this->getMetadata()->getModuleList() : $this->getFileManager()->getFileList($customDir, false, '', false);

            foreach ($moduleList as $moduleName) {
                $curPath = str_replace('{*}', $moduleName, $paths['modulePath']);

                if ($this->useObjects) {
                    $content = Utils\DataUtil::merge($content, $this->unifySingle($curPath, $name, $recursively, $moduleName));
                } else {
                    $content = Utils\Util::merge($content, $this->unifySingle($curPath, $name, $recursively, $moduleName));
                }
            }
        }

        if (!empty($paths['customPath'])) {
            if ($this->useObjects) {
                $content = Utils\DataUtil::merge($content, $this->unifySingle($paths['customPath'], $name, $recursively));
            } else {
                $content = Utils\Util::merge($content, $this->unifySingle($paths['customPath'], $name, $recursively));
            }
        }

        return $content;
    }
public function unify($name, $paths, $recursively = false)
    {
        $content = $this->unifySingle($paths['corePath'], $name, $recursively);

        if (!empty($paths['modulePath'])) {
            $customDir = strstr($paths['modulePath'], '{*}', true);

            $moduleList = isset($this->metadata) ? $this->getMetadata()->getModuleList() : $this->getFileManager()->getFileList($customDir, false, '', false);

            foreach ($moduleList as $moduleName) {
                $curPath = str_replace('{*}', $moduleName, $paths['modulePath']);

                if ($this->useObjects) {
                    $content = Utils\DataUtil::merge($content, $this->unifySingle($curPath, $name, $recursively, $moduleName));
                } else {
                    $content = Utils\Util::merge($content, $this->unifySingle($curPath, $name, $recursively, $moduleName));
                }
            }
        }

        if (!empty($paths['customPath'])) {
            if ($this->useObjects) {
                $content = Utils\DataUtil::merge($content, $this->unifySingle($paths['customPath'], $name, $recursively));
            } else {
                $content = Utils\Util::merge($content, $this->unifySingle($paths['customPath'], $name, $recursively));
            }
        }

        return $content;
    }
public function unify ( $ name , $ paths , $ recursively = false ) { $ content = $ this -> unifySingle ( $ paths [ 'corePath' ] , $ name , $ recursively ) ; if ( ! empty ( $ paths [ 'modulePath' ] ) ) { $ customDir = strstr ( $ paths [ 'modulePath' ] , '{*}' , true ) ; $ moduleList = isset ( $ this -> metadata ) ? $ this -> getMetadata ( ) -> getModuleList ( ) : $ this -> getFileManager ( ) -> getFileList ( $ customDir , false , '' , false ) ; foreach ( $ moduleList as $ moduleName ) { $ curPath = str_replace ( '{*}' , $ moduleName , $ paths [ 'modulePath' ] ) ; if ( $ this -> useObjects ) { $ content = Utils \ DataUtil :: merge ( $ content , $ this -> unifySingle ( $ curPath , $ name , $ recursively , $ moduleName ) ) ; } else { $ content = Utils \ Util :: merge ( $ content , $ this -> unifySingle ( $ curPath , $ name , $ recursively , $ moduleName ) ) ; } } } if ( ! empty ( $ paths [ 'customPath' ] ) ) { if ( $ this -> useObjects ) { $ content = Utils \ DataUtil :: merge ( $ content , $ this -> unifySingle ( $ paths [ 'customPath' ] , $ name , $ recursively ) ) ; } else { $ content = Utils \ Util :: merge ( $ content , $ this -> unifySingle ( $ paths [ 'customPath' ] , $ name , $ recursively ) ) ; } } return $ content ; }
Unite file content to the file

@param  string  $name
@param  array  $paths
@param  boolean $recursively Note: only for first level of sub directory, other levels of sub directories will be ignored

@return array
Unite file content to the file