original_string: public function getPublicDirectory()
      {
          if (isset($this->publicDirectory)) {
              return $this->publicDirectory;
          }
          
          $rootPkg = $this->composer->getPackage();
          
          if ($rootPkg) {
              $extra = $rootPkg->getExtra();
              
              if ($extra && ! empty($extra['public-dir'])) {
                  return $this->publicDirectory = $extra['public-dir'];
              }
          }
          
          $common_public_dirs = [
              'public',
              'public_html',
              'htdocs',
              'httpdocs',
              'html',
              'web',
              'www',
          ];
          
          $public = null;
          
          foreach ($common_public_dirs as $dir) {
              if (file_exists($dir)) {
                  $public = $dir;
                  
                  break;
              }
          }
          
          $publicDirQuestion = 'What is the public directory (web root) for this project?';
          
          if (! $public) {
              if ($this->io->isInteractive()) {
                  return $this->publicDirectory = trim($this->ask($publicDirQuestion, $common_public_dirs[0]), '/');
              }
              
              return $this->publicDirectory = $common_public_dirs[0];
          }
          
          if ($this->io->isInteractive()) {
              return $this->publicDirectory = trim($this->ask($publicDirQuestion, $public), '/');
          }
          
          return $this->publicDirectory = $public;
      }
code: public function getPublicDirectory()
      {
          if (isset($this->publicDirectory)) {
              return $this->publicDirectory;
          }
          
          $rootPkg = $this->composer->getPackage();
          
          if ($rootPkg) {
              $extra = $rootPkg->getExtra();
              
              if ($extra && ! empty($extra['public-dir'])) {
                  return $this->publicDirectory = $extra['public-dir'];
              }
          }
          
          $common_public_dirs = [
              'public',
              'public_html',
              'htdocs',
              'httpdocs',
              'html',
              'web',
              'www',
          ];
          
          $public = null;
          
          foreach ($common_public_dirs as $dir) {
              if (file_exists($dir)) {
                  $public = $dir;
                  
                  break;
              }
          }
          
          $publicDirQuestion = 'What is the public directory (web root) for this project?';
          
          if (! $public) {
              if ($this->io->isInteractive()) {
                  return $this->publicDirectory = trim($this->ask($publicDirQuestion, $common_public_dirs[0]), '/');
              }
              
              return $this->publicDirectory = $common_public_dirs[0];
          }
          
          if ($this->io->isInteractive()) {
              return $this->publicDirectory = trim($this->ask($publicDirQuestion, $public), '/');
          }
          
          return $this->publicDirectory = $public;
      }
code_tokens: public function getPublicDirectory ( ) { if ( isset ( $ this -> publicDirectory ) ) { return $ this -> publicDirectory ; } $ rootPkg = $ this -> composer -> getPackage ( ) ; if ( $ rootPkg ) { $ extra = $ rootPkg -> getExtra ( ) ; if ( $ extra && ! empty ( $ extra [ 'public-dir' ] ) ) { return $ this -> publicDirectory = $ extra [ 'public-dir' ] ; } } $ common_public_dirs = [ 'public' , 'public_html' , 'htdocs' , 'httpdocs' , 'html' , 'web' , 'www' , ] ; $ public = null ; foreach ( $ common_public_dirs as $ dir ) { if ( file_exists ( $ dir ) ) { $ public = $ dir ; break ; } } $ publicDirQuestion = 'What is the public directory (web root) for this project?' ; if ( ! $ public ) { if ( $ this -> io -> isInteractive ( ) ) { return $ this -> publicDirectory = trim ( $ this -> ask ( $ publicDirQuestion , $ common_public_dirs [ 0 ] ) , '/' ) ; } return $ this -> publicDirectory = $ common_public_dirs [ 0 ] ; } if ( $ this -> io -> isInteractive ( ) ) { return $ this -> publicDirectory = trim ( $ this -> ask ( $ publicDirQuestion , $ public ) , '/' ) ; } return $ this -> publicDirectory = $ public ; }
docstring: Get the public directory.
  
  @return string
docstring_tokens: Get the public directory .