public function offsetSet($index, $newval)
    {
        if (!$newval instanceof TableOfContents\File) {
            throw new \InvalidArgumentException('A table of contents may only be filled with File objects');
        }

        $basename = basename($newval->getFilename());
        if (strpos($basename, '.') !== false) {
            $basename = substr($basename, 0, strpos($basename, '.'));
        }

        if (strtolower($basename) === 'index') {
            $this->modules[] = $newval;
        }

        parent::offsetSet($newval->getFilename(), $newval);
    }
public function offsetSet($index, $newval)
    {
        if (!$newval instanceof TableOfContents\File) {
            throw new \InvalidArgumentException('A table of contents may only be filled with File objects');
        }

        $basename = basename($newval->getFilename());
        if (strpos($basename, '.') !== false) {
            $basename = substr($basename, 0, strpos($basename, '.'));
        }

        if (strtolower($basename) === 'index') {
            $this->modules[] = $newval;
        }

        parent::offsetSet($newval->getFilename(), $newval);
    }
public function offsetSet ( $ index , $ newval ) { if ( ! $ newval instanceof TableOfContents \ File ) { throw new \ InvalidArgumentException ( 'A table of contents may only be filled with File objects' ) ; } $ basename = basename ( $ newval -> getFilename ( ) ) ; if ( strpos ( $ basename , '.' ) !== false ) { $ basename = substr ( $ basename , 0 , strpos ( $ basename , '.' ) ) ; } if ( strtolower ( $ basename ) === 'index' ) { $ this -> modules [ ] = $ newval ; } parent :: offsetSet ( $ newval -> getFilename ( ) , $ newval ) ; }
Override offsetSet to force the use of the relative filename.

@param void $index
@param TableOfContents\File $newval

@throws \InvalidArgumentException if something other than a file is provided.
Override offsetSet to force the use of the relative filename .