Get URL parameters inside custom module
<p>I've created a custom block like this:</p>

<pre><code>class HelloBlock extends BlockBase implements BlockPluginInterface{

  /**
   * {@inheritdoc}
   */
  public function build() {
    $config = $this-&gt;getConfiguration();
    $result = db_query('SELECT * FROM {test}');
    return array(
      '#theme' =&gt; 'world',
      '#test' =&gt; $result
    );
  }
}
</code></pre>

<p>And I now want to programmatically get some parameter from the URL.</p>

<p>For example:</p>

<p>If the URL is <code>http://localhost/drup/hello/5569</code> I want to get hold of the value <code>5569</code> inside my module. </p>

<p>I have tried <code>arg(1)</code> and <code>drupal_get_query_parameters()</code> but I got this error messages:</p>

<pre><code>Call to undefined function `Drupal\hello\Plugin\Block\arg()`
</code></pre>

<p>and</p>

<pre><code>Call to undefined function `Drupal\hello\Plugin\Block\drupal_get_query_parameters()`
</code></pre>

<p>How can I get the parameters?</p>