Redaxscript\Template\Helper::getRobots PHP Метод

getRobots() публичный статический Метод

get the keywords
С версии: 3.0.0
public static getRobots ( ) : string
Результат string
    public static function getRobots()
    {
        $lastTable = Registry::get('lastTable');
        $lastId = Registry::get('lastId');
        $contentError = Registry::get('contentError');
        $metaRobots = Registry::get('metaRobots');
        /* find robots */
        if ($metaRobots) {
            $robots = $metaRobots;
        } else {
            if ($contentError) {
                $robots = 0;
            } else {
                if ($lastTable && $lastId) {
                    $lastContent = Db::forTablePrefix($lastTable)->whereIdIs($lastId)->whereNull('access')->findOne();
                    $robots = $lastContent->robots;
                }
            }
        }
        /* handle robots */
        if (array_key_exists($robots, self::$_robotArray)) {
            return self::$_robotArray[$robots];
        }
        return self::$_robot;
    }

Usage Example

Пример #1
0
 /**
  * testGetRobots
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param string $expect
  *
  * @dataProvider providerGetRobots
  */
 public function testGetRobots($registryArray = [], $expect = null)
 {
     /* setup */
     $this->_registry->init($registryArray);
     /* actual */
     $actual = Template\Helper::getRobots();
     /* compare */
     $this->assertEquals($expect, $actual);
 }