code: public function getShardingIdentifier(array $tableConfig, $shardingKey)
      {
          is_array($tableConfig['shards']) or $tableConfig['shards'] = array();
  
          $count = count($tableConfig['shards']);
  
          $toReturn = null;
  
          switch ($count) {
              case 0:
                  throw new \Exception("No shards defined : can't compute modulo");
                  break;
              case 1:
                  return null;
                  break;
  
              default:
                  $toReturn = $shardingKey % count($tableConfig['shards']);
                  break;
          }
  
          return $toReturn;
      }
docs: @param array $tableConfig
  @param mixed $shardingKey
  
  @return int|null
  @throws \Exception