capacity = max( 1, (int) $capacity ); } /** * True when the key was seen before. * * @param string $key Key. * @return bool */ public function has( $key ) { return isset( $this->keys[ $key ] ); } /** * Remembers a key. * * @param string $key Key. */ public function add( $key ) { if ( count( $this->keys ) >= $this->capacity ) { unset( $this->keys[ array_key_first( $this->keys ) ] ); } $this->keys[ $key ] = true; } }