Corcel\Options::getAll PHP Метод

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

Gets all the options.
public static getAll ( ) : array
Результат array
    public static function getAll()
    {
        $options = self::all();
        $result = [];
        foreach ($options as $option) {
            $result[$option->option_name] = $option->value;
        }
        return $result;
    }

Usage Example

Пример #1
0
 /**
  * Test getting some options.
  */
 public function testGetOptions()
 {
     // Get all the options and test some
     $options = Options::getAll();
     $this->assertNotNull($options);
     // String value
     $this->assertArrayHasKey('blogname', $options);
     $this->assertEquals('Wordpress Corcel', $options['blogname']);
     // Array value
     $this->assertArrayHasKey('wp_user_roles', $options);
     $this->assertCount(5, $options['wp_user_roles']);
     $this->assertEquals('Administrator', $options['wp_user_roles']['administrator']['name']);
     // Get single values
     $this->assertEquals('*****@*****.**', Options::get('admin_email'));
     $this->assertEquals(false, Options::get('moderation_keys'));
     $themeRoots = Options::get('_site_transient_theme_roots');
     $this->assertNotNull($themeRoots);
     $this->assertEquals('/themes', $themeRoots['twentyfourteen']);
 }