original_string: public function checkDatabase($showAllData = true)
      {
          switch ($this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
              case 'mysql':
                  $sth = $this->pdo->prepare('SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ?');
                  $sth->execute(array($this->tableName));
                  $columnNameColumn = 'COLUMN_NAME';
                  break;
              case 'sqlite':
                  $sth = $this->pdo->prepare("PRAGMA table_info($this->tableName)");
                  $sth->execute();
                  $columnNameColumn = 'name';
                  break;
              default:
                  echo '<p>SQL Driver: ' . $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME) . ' is not supported by the checking tool... sorry</p>' . PHP_EOL;
                  return;
          }
          $tableProperties = $sth->fetchAll();
          $classProperties = $this->entityClass->getProperties();
  
          $properties = [];
  
          foreach ($tableProperties as $prop) {
              $newProp = new stdClass();
              $newProp->actualColumnName = $prop[$columnNameColumn];
              $properties[$newProp->actualColumnName] = $newProp;
          }
  
          foreach ($classProperties as $prop) {
              $expectedColumnName = $this->namingContention->propertyToColumnName($prop);
              if (array_key_exists($expectedColumnName, $properties)) {
                  $newProp = $properties[$expectedColumnName];
              } else {
                  $newProp = new stdClass();
                  $properties[$expectedColumnName] = $newProp;
              }
              $newProp->propertyName = $prop->getName();
              $newProp->expectedColumnName = $expectedColumnName;
          }
  
          $issetOr = function (&$value, $default = '') {
              return isset($value) ? $value : $default;
          };
  
          $pdoAtt = function ($att) {
              try {
                  return $this->pdo->getAttribute($att);
              } catch (PDOException $e) {
                  return 'Not supported by driver';
              }
          };
  
          $getClass = function (stdClass $prop) use ($issetOr) {
              $classes = $issetOr($prop->expectedColumnName) === $issetOr($prop->actualColumnName) ? 'correct' : 'error';
  
              if ($issetOr($prop->propertyName) === $this->idProperty->getName()) {
                  $classes .= ' primary-key';
              }
  
              return $classes;
          };
  
          $entitiesError = false;
          $entities = [];
          if ($showAllData) {
              try {
                  $entities = $this->findAll();
              } catch (\Exception $e) {
                  $entitiesError = $e;
              }
          }
  
  
          include 'Check/checkDatabaseTable.php';
      }
code: public function checkDatabase($showAllData = true)
      {
          switch ($this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
              case 'mysql':
                  $sth = $this->pdo->prepare('SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ?');
                  $sth->execute(array($this->tableName));
                  $columnNameColumn = 'COLUMN_NAME';
                  break;
              case 'sqlite':
                  $sth = $this->pdo->prepare("PRAGMA table_info($this->tableName)");
                  $sth->execute();
                  $columnNameColumn = 'name';
                  break;
              default:
                  echo '<p>SQL Driver: ' . $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME) . ' is not supported by the checking tool... sorry</p>' . PHP_EOL;
                  return;
          }
          $tableProperties = $sth->fetchAll();
          $classProperties = $this->entityClass->getProperties();
  
          $properties = [];
  
          foreach ($tableProperties as $prop) {
              $newProp = new stdClass();
              $newProp->actualColumnName = $prop[$columnNameColumn];
              $properties[$newProp->actualColumnName] = $newProp;
          }
  
          foreach ($classProperties as $prop) {
              $expectedColumnName = $this->namingContention->propertyToColumnName($prop);
              if (array_key_exists($expectedColumnName, $properties)) {
                  $newProp = $properties[$expectedColumnName];
              } else {
                  $newProp = new stdClass();
                  $properties[$expectedColumnName] = $newProp;
              }
              $newProp->propertyName = $prop->getName();
              $newProp->expectedColumnName = $expectedColumnName;
          }
  
          $issetOr = function (&$value, $default = '') {
              return isset($value) ? $value : $default;
          };
  
          $pdoAtt = function ($att) {
              try {
                  return $this->pdo->getAttribute($att);
              } catch (PDOException $e) {
                  return 'Not supported by driver';
              }
          };
  
          $getClass = function (stdClass $prop) use ($issetOr) {
              $classes = $issetOr($prop->expectedColumnName) === $issetOr($prop->actualColumnName) ? 'correct' : 'error';
  
              if ($issetOr($prop->propertyName) === $this->idProperty->getName()) {
                  $classes .= ' primary-key';
              }
  
              return $classes;
          };
  
          $entitiesError = false;
          $entities = [];
          if ($showAllData) {
              try {
                  $entities = $this->findAll();
              } catch (\Exception $e) {
                  $entitiesError = $e;
              }
          }
  
  
          include 'Check/checkDatabaseTable.php';
      }
code_tokens: public function checkDatabase ( $ showAllData = true ) { switch ( $ this -> pdo -> getAttribute ( PDO :: ATTR_DRIVER_NAME ) ) { case 'mysql' : $ sth = $ this -> pdo -> prepare ( 'SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ?' ) ; $ sth -> execute ( array ( $ this -> tableName ) ) ; $ columnNameColumn = 'COLUMN_NAME' ; break ; case 'sqlite' : $ sth = $ this -> pdo -> prepare ( "PRAGMA table_info($this->tableName)" ) ; $ sth -> execute ( ) ; $ columnNameColumn = 'name' ; break ; default : echo '<p>SQL Driver: ' . $ this -> pdo -> getAttribute ( PDO :: ATTR_DRIVER_NAME ) . ' is not supported by the checking tool... sorry</p>' . PHP_EOL ; return ; } $ tableProperties = $ sth -> fetchAll ( ) ; $ classProperties = $ this -> entityClass -> getProperties ( ) ; $ properties = [ ] ; foreach ( $ tableProperties as $ prop ) { $ newProp = new stdClass ( ) ; $ newProp -> actualColumnName = $ prop [ $ columnNameColumn ] ; $ properties [ $ newProp -> actualColumnName ] = $ newProp ; } foreach ( $ classProperties as $ prop ) { $ expectedColumnName = $ this -> namingContention -> propertyToColumnName ( $ prop ) ; if ( array_key_exists ( $ expectedColumnName , $ properties ) ) { $ newProp = $ properties [ $ expectedColumnName ] ; } else { $ newProp = new stdClass ( ) ; $ properties [ $ expectedColumnName ] = $ newProp ; } $ newProp -> propertyName = $ prop -> getName ( ) ; $ newProp -> expectedColumnName = $ expectedColumnName ; } $ issetOr = function ( & $ value , $ default = '' ) { return isset ( $ value ) ? $ value : $ default ; } ; $ pdoAtt = function ( $ att ) { try { return $ this -> pdo -> getAttribute ( $ att ) ; } catch ( PDOException $ e ) { return 'Not supported by driver' ; } } ; $ getClass = function ( stdClass $ prop ) use ( $ issetOr ) { $ classes = $ issetOr ( $ prop -> expectedColumnName ) === $ issetOr ( $ prop -> actualColumnName ) ? 'correct' : 'error' ; if ( $ issetOr ( $ prop -> propertyName ) === $ this -> idProperty -> getName ( ) ) { $ classes .= ' primary-key' ; } return $ classes ; } ; $ entitiesError = false ; $ entities = [ ] ; if ( $ showAllData ) { try { $ entities = $ this -> findAll ( ) ; } catch ( \ Exception $ e ) { $ entitiesError = $ e ; } } include 'Check/checkDatabaseTable.php' ; }
docstring: This method will run some analysis on the correctness of your configuration. It will be exported to the screen.
  @param boolean $showAllData set this to false if you want to hide the entities row
docstring_tokens: This method will run some analysis on the correctness of your configuration . It will be exported to the screen .