dependencies = $dependencies; } /** * @param $key * @param $dependency * * @throws Exception */ public function set( $key, $dependency ) { if ( isset( $this->dependencies[ $key ] ) ) { throw new InvalidArgumentException( 'Dependency key ' . esc_html( $key ) . ' already exists' ); } $this->dependencies[ $key ] = $dependency; } /** * @param $key * * @return mixed * @throws Exception */ public function get( $key ) { if ( ! isset( $this->dependencies[ $key ] ) ) { throw new InvalidArgumentException( 'Dependency key ' . esc_html( $key ) . ' does not exist' ); } return $this->dependencies[ $key ]; } }