public function testInsertAt() { $dummy = new DummyExample('test'); $this->assertEquals(insert_at(array(1, 2, 3), 0, 0), array(0, 1, 2, 3)); $this->assertEquals(insert_at(array(1, 2, 3), 4, 3), array(1, 2, 3, 4)); $this->assertEquals(insert_at(array(1, 2, 3), $dummy, 3), array(1, 2, 3, $dummy)); }
function css($file, $version = null, $index = -1, $module = null, $less = false) { foreach ($this->cssFiles as $k => $css) { if ($css->name === $file) { if ($css->version === $version) { return false; } else { trigger_error('The css file ' . $file . ' of version ' . $version . ' has a different version ' . $css->version . ' registered'); break; } } } $css = new CssLink($file, $version, $module, $less); if ($index == -1) { $this->cssFiles[] = $css; } else { $this->cssFiles = insert_at($this->cssFiles, $css, $index); } }