Programmatically creating a custom block I followed the steps from https://www.webwash.net/programmatically-create-block-drupal-8/.
I have a view already created and I want to render this view in this block. 
I can't find a good documentation for build() function.

The reason is that I want to hide the view for a role implicitly included by authenticated role.

How can I display the existing view inside the custom block I've created?
I didn't find a way to display the view and restrict for certain roles.

But I've managed to solve the problem in another way.

I created a script in Admin > Structure > Block > My_Block > Configure > Visibility PHP:

&lt;?php 
$match = TRUE;
$heh = \Drupal::currentUser()-&gt;getAccount()-&gt;getRoles(TRUE);
$hide_from_roles = array('administrator', 'sefii', 'membership');
 if (count(array_intersect($heh, $hide_from_roles)) &gt; 0) {
    $match = FALSE;
}
return $match;
?&gt;