/**
  * @dataProvider replace
  * @depends test_replace
  */
 public function test_replace_in_array($existing, $replacements, $expected)
 {
     $attributes['class'] = $existing;
     $actual = classes::replace($attributes, $replacements);
     $this->assertArrayHasKey('class', $actual);
     $this->assertSame($expected, $actual['class']);
     $attributes = array();
     $actual = classes::replace($attributes, $replacements);
     $this->assertArrayHasKey('class', $actual);
     $this->assertSame('', $actual['class']);
 }
 public function block(block_contents $bc, $region)
 {
     $bc->attributes['class'] = classes::replace($bc->attributes['class'], array('invisible' => 'muted'));
     $bc = clone $bc;
     if (empty($bc->blockinstanceid) || !strip_tags($bc->title)) {
         $bc->collapsible = block_contents::NOT_HIDEABLE;
     }
     if ($bc->collapsible == block_contents::HIDDEN) {
         $bc->add_class('hidden');
     }
     if (!empty($bc->controls)) {
         $bc->add_class('block_with_controls');
     }
     $bc->add_class('well');
     // Bootstrap style.
     // Bit strange of bootstrap to hard code the style below but that's what the example does.
     $bc->attributes['style'] = 'padding: 8px 0;';
     $skiptitle = strip_tags($bc->title);
     if (empty($skiptitle)) {
         $output = '';
         $skipdest = '';
     } else {
         $output = html::a(array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'), get_string('skipa', 'access', $skiptitle));
         $skipdest = html::span(array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
     }
     $output .= html::div($bc->attributes, $this->block_header($bc) . $this->block_content($bc));
     $output .= $this->block_annotation($bc);
     $output .= $skipdest;
     $this->init_block_hider_js($bc);
     return $output;
 }
 private static function bootstrap_to_zurb($tag, $classes)
 {
     return classes::replace($classes, self::$to_zurb[$tag]);
 }