/** * returns a cached video object or adds existing videos to the cache * * @param int|VideoTable[] $id * @return VideoTable|null */ static public function getVideo( $id ) { static $cache = array(); if ( is_array( $id ) ) { foreach ( $id as $row ) { /** @var VideoTable $row */ $rowId = (int) $row->get( 'id' ); if ( ! $rowId ) { continue; } $cache[$rowId] = $row; } return null; } elseif ( ! $id ) { return new VideoTable(); } elseif ( ! isset( $cache[$id] ) ) { $row = new VideoTable(); $row->load( (int) $id ); $cache[$id] = $row; } return $cache[$id]; }